/**
 *
 */
import OpenApi;
import OpenApi.OpenApiUtil;

extends OpenApi;


init(config: OpenApiUtil.Config){
  super(config);
  @endpointRule = 'regional';
  @endpointMap = {
    'cn-qingdao' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-beijing' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-chengdu' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-zhangjiakou' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-huhehaote' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-hangzhou' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-shanghai' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-shenzhen' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-heyuan' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-wulanchabu' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-hongkong' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'ap-southeast-1' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'ap-southeast-2' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'ap-southeast-3' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'ap-southeast-5' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'eu-west-1' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'us-west-1' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'us-east-1' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'eu-central-1' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'me-east-1' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'ap-south-1' = 'wafopenapi.ap-southeast-1.aliyuncs.com',
    'cn-shanghai-finance-1' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-shenzhen-finance-1' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
    'cn-north-2-gov-1' = 'wafopenapi.cn-hangzhou.aliyuncs.com',
  };

  checkConfig(config);
  @endpoint = getEndpoint('waf-openapi', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!$isNull(endpoint)) {
    return endpoint;
  }
  
  if (!$isNull(endpointMap) && !$isNull(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return OpenApiUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ChangeResourceGroupRequest {
  newResourceGroupId?: string(name='NewResourceGroupId', description='The ID of the new resource group. You can view the available resource groups in the Resource Management console.

This parameter is required.', example='rg-aek2mcq***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceId?: string(name='ResourceId', description='The ID of the protected object that you want to manage.

This parameter is required.', example='demo.aliyun.com-waf'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  resourceType?: string(name='ResourceType', description='The resource type. Set the value to defenseresource.

This parameter is required.', example='defenseresource'),
}

model ChangeResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0A916D48-D206-5654-8D37-***'),
}

model ChangeResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ChangeResourceGroupResponseBody(name='body'),
}

/**
 * @summary Changes the resource group to which a protected object belongs.
 *
 * @param request ChangeResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroupWithOptions(request: ChangeResourceGroupRequest, runtime: $RuntimeOptions): ChangeResourceGroupResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.newResourceGroupId)) {
    query['NewResourceGroupId'] = request.newResourceGroupId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ChangeResourceGroup',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the resource group to which a protected object belongs.
 *
 * @param request ChangeResourceGroupRequest
 * @return ChangeResourceGroupResponse
 */
async function changeResourceGroup(request: ChangeResourceGroupRequest): ChangeResourceGroupResponse {
  var runtime = new $RuntimeOptions{};
  return changeResourceGroupWithOptions(request, runtime);
}

model ClearMajorProtectionBlackIpRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  ruleId?: long(name='RuleId', description='The ID of the IP address blacklist rule for major event protection.

This parameter is required.', example='20012033'),
  templateId?: long(name='TemplateId', description='The ID of the IP address blacklist rule template for major event protection.

This parameter is required.', example='5132'),
}

model ClearMajorProtectionBlackIpResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='66A98669-CC6E-4F3E-80A6-3014697B11AE'),
}

model ClearMajorProtectionBlackIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ClearMajorProtectionBlackIpResponseBody(name='body'),
}

/**
 * @summary Clears an IP address blacklist for major event protection.
 *
 * @param request ClearMajorProtectionBlackIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ClearMajorProtectionBlackIpResponse
 */
async function clearMajorProtectionBlackIpWithOptions(request: ClearMajorProtectionBlackIpRequest, runtime: $RuntimeOptions): ClearMajorProtectionBlackIpResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ClearMajorProtectionBlackIp',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Clears an IP address blacklist for major event protection.
 *
 * @param request ClearMajorProtectionBlackIpRequest
 * @return ClearMajorProtectionBlackIpResponse
 */
async function clearMajorProtectionBlackIp(request: ClearMajorProtectionBlackIpRequest): ClearMajorProtectionBlackIpResponse {
  var runtime = new $RuntimeOptions{};
  return clearMajorProtectionBlackIpWithOptions(request, runtime);
}

model CopyDefenseTemplateRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-lbj****x10g'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  templateId?: long(name='TemplateId', description='The ID of the protection template that you want to copy.

This parameter is required.', example='12345'),
}

model CopyDefenseTemplateResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
  templateId?: long(name='TemplateId', description='The ID of the new protection template.', example='12346'),
}

model CopyDefenseTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CopyDefenseTemplateResponseBody(name='body'),
}

/**
 * @summary Creates a new protection template from the copy.
 *
 * @param request CopyDefenseTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CopyDefenseTemplateResponse
 */
async function copyDefenseTemplateWithOptions(request: CopyDefenseTemplateRequest, runtime: $RuntimeOptions): CopyDefenseTemplateResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CopyDefenseTemplate',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a new protection template from the copy.
 *
 * @param request CopyDefenseTemplateRequest
 * @return CopyDefenseTemplateResponse
 */
async function copyDefenseTemplate(request: CopyDefenseTemplateRequest): CopyDefenseTemplateResponse {
  var runtime = new $RuntimeOptions{};
  return copyDefenseTemplateWithOptions(request, runtime);
}

model CreateApiExportRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='993'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-zxu3***'),
  param?: string(name='Param', description='The extended parameters of the data export task. The parameter value is in the JSON format. The following keys are supported:

*   **instanceId**: the instance ID
*   **clusterId**: the ID of the hybrid cloud cluster
*   **orderKey**: the name of the field used to sort exported data
*   **orderWay**: the sorting method of the exported data', example='{
    "orderWay": "asc",
    "orderKey": "endTs",
    "instanceId": "waf_v3prepaid_public_cn-****"
}'),
  region?: string(name='Region', description='Language type. Valid values:
- **cn**: Chinese.
- **en**: English.', example='cn'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  type?: string(name='Type', description='The type of the data export task. Valid values:

*   **apisec_api**: API tasks
*   **apisec_abnormal**: API risk tasks
*   **apisec_event**: API security event tasks', example='apisec_api'),
  zoneId?: string(name='ZoneId', description='The ID of the time zone.', example='Asia/Shanghai'),
}

model CreateApiExportResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='62382992-F9AA-52B2-9147-66B3B9E51D74'),
}

model CreateApiExportResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateApiExportResponseBody(name='body'),
}

/**
 * @summary Creates a data export task in the API security module.
 *
 * @param request CreateApiExportRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateApiExportResponse
 */
async function createApiExportWithOptions(request: CreateApiExportRequest, runtime: $RuntimeOptions): CreateApiExportResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.param)) {
    query['Param'] = request.param;
  }
  if (!$isNull(request.region)) {
    query['Region'] = request.region;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  if (!$isNull(request.zoneId)) {
    query['ZoneId'] = request.zoneId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateApiExport',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a data export task in the API security module.
 *
 * @param request CreateApiExportRequest
 * @return CreateApiExportResponse
 */
async function createApiExport(request: CreateApiExportRequest): CreateApiExportResponse {
  var runtime = new $RuntimeOptions{};
  return createApiExportWithOptions(request, runtime);
}

model CreateCloudResourceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-***'),
  listen?: {
    certificates?: [ 
      {
        appliedType?: string(name='AppliedType', description='The type of the certificate. Valid values:

*   **default**: default certificate.
*   **extension**: additional certificate.', example='default'),
        certificateId?: string(name='CertificateId', description='The ID of the certificate that you want to add.

>  You can call the [DescribeCertificates](https://help.aliyun.com/document_detail/160783.html) operation to query the IDs of all SSL certificates that are associated with a domain name.', example='123-cn-hangzhou'),
      }
    ](name='Certificates', description='The certificates.'),
    cipherSuite?: int32(name='CipherSuite', description='The type of the cipher suites that you want to add. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **1**: all cipher suites.
*   **2**: strong cipher suites. This value is available only if you set **TLSVersion** to **tlsv1.2**.
*   **99**: custom cipher suites.', example='1'),
    customCiphers?: [ string ](name='CustomCiphers', description='The custom cipher suites that you want to add. This parameter is available only if you set **CipherSuite** to **99**.'),
    enableTLSv3?: boolean(name='EnableTLSv3', description='Specifies whether to support TLS 1.3. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false**', example='true', nullable=true),
    http2Enabled?: boolean(name='Http2Enabled', description='Specifies whether to enable HTTP/2. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false** (default)', example='true'),
    port?: int32(name='Port', description='The port of the cloud service.

This parameter is required.', example='80'),
    protocol?: string(name='Protocol', description='The protocol type. Valid values:

*   **http**
*   **https**

This parameter is required.', example='http'),
    resourceInstanceId?: string(name='ResourceInstanceId', description='The instance ID of the cloud service.

This parameter is required.', example='lb-bp1*****'),
    resourceProduct?: string(name='ResourceProduct', description='The type of the cloud service that you want to add. Valid values:

*   **clb4**: Layer 4 CLB.
*   **clb7**: Layer 7 CLB.
*   **ecs**: ECS.
*   **nlb**: Network Load Balancer (NLB).

This parameter is required.', example='clb4'),
    TLSVersion?: string(name='TLSVersion', description='The Transport Layer Security (TLS) version that you want to add. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **tlsv1**
*   **tlsv1.1**
*   **tlsv1.2**', example='tlsv1'),
  }(name='Listen', description='The listener configurations.

This parameter is required.'),
  ownerUserId?: string(name='OwnerUserId', description='The ID of the Alibaba Cloud account to which the resource belongs.', example='123'),
  redirect?: {
    keepalive?: boolean(name='Keepalive', description='Specifies whether to enable the persistent connection feature. Valid values:

*   **true** (default)
*   **false**', example='true'),
    keepaliveRequests?: int32(name='KeepaliveRequests', description='The number of reused persistent connections. Valid values: 60 to 1000.

>  This parameter specifies the number of persistent connections that can be reused after you enable the persistent connection feature.', example='1000'),
    keepaliveTimeout?: int32(name='KeepaliveTimeout', description='The timeout period of idle persistent connections. Valid values: 10 to 3600. Default value: 3600. Unit: seconds.

>  This parameter specifies the period of time after which an idle persistent connection is closed.', example='15'),
    readTimeout?: int32(name='ReadTimeout', description='The timeout period of read connections. Unit: seconds. Valid values: 1 to 3600.', example='1'),
    requestHeaders?: [ 
      {
        key?: string(name='Key', description='The key of the custom header field.', example='key1'),
        value?: string(name='Value', description='The value of the custom header field.', example='value1'),
      }
    ](name='RequestHeaders', description='The custom header fields. Specify the value in the [**{"k":"*key*","v":"*value*"}**] format. ***key*** specifies the key of a custom header field. ***value*** specifies the value of a custom header field.

>  If a request contains a custom header field, WAF overwrites the original value of the field with the specified value.'),
    writeTimeout?: int32(name='WriteTimeout', description='The timeout period of write connections. Unit: seconds. Valid values: 1 to 3600.', example='1'),
    xffHeaderMode?: int32(name='XffHeaderMode', description='The method that is used to obtain the originating IP address of a client. Valid values:

*   **0**: No Layer 7 proxies are deployed in front of WAF.
*   **1**: WAF reads the first value of the X-Forwarded-For (XFF) header field as the originating IP address of the client.
*   **2**: WAF reads the value of a custom header field as the originating IP address of the client.', example='1'),
    xffHeaders?: [ string ](name='XffHeaders', description='The custom header fields that are used to obtain the originating IP address of a client. Specify the value in the **["header1","header2",...]** format.

>  This parameter is required only if you set **XffHeaderMode** to 2.'),
    xffProto?: boolean(name='XffProto', description='Specifies whether to use the X-Forward-For-Proto header field to pass the protocol used by WAF to forward requests to the origin server. Valid values:

*   **true** (default)
*   **false**', example='true'),
  }(name='Redirect', description='The forwarding configurations.'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.', example='TagKey1'),
      value?: string(name='Value', description='The value of the tag.', example='TagValue1'),
    }
  ](name='Tag', description='The tags. You can specify up to 20 tags.'),
}

model CreateCloudResourceShrinkRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-***'),
  listenShrink?: string(name='Listen', description='The listener configurations.

This parameter is required.'),
  ownerUserId?: string(name='OwnerUserId', description='The ID of the Alibaba Cloud account to which the resource belongs.', example='123'),
  redirectShrink?: string(name='Redirect', description='The forwarding configurations.'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.', example='TagKey1'),
      value?: string(name='Value', description='The value of the tag.', example='TagValue1'),
    }
  ](name='Tag', description='The tags. You can specify up to 20 tags.'),
}

model CreateCloudResourceResponseBody = {
  cloudResourceId?: string(name='CloudResourceId', description='The ID of the resource that is added to WAF. The ID is automatically generated.', example='lb-***'),
  requestId?: string(name='RequestId', description='The request ID.', example='66A98669-ER12-WE34-23PO-301469*****E'),
}

model CreateCloudResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCloudResourceResponseBody(name='body'),
}

/**
 * @summary Adds a service to Web Application Firewall (WAF). This operation is supported for only the Elastic Compute Service (ECS) and Classic Load Balancer (CLB) services.
 *
 * @param tmpReq CreateCloudResourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCloudResourceResponse
 */
async function createCloudResourceWithOptions(tmpReq: CreateCloudResourceRequest, runtime: $RuntimeOptions): CreateCloudResourceResponse {
  tmpReq.validate();
  var request = new CreateCloudResourceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.listen)) {
    request.listenShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.listen, 'Listen', 'json');
  }
  if (!$isNull(tmpReq.redirect)) {
    request.redirectShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.redirect, 'Redirect', 'json');
  }
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.listenShrink)) {
    query['Listen'] = request.listenShrink;
  }
  if (!$isNull(request.ownerUserId)) {
    query['OwnerUserId'] = request.ownerUserId;
  }
  if (!$isNull(request.redirectShrink)) {
    query['Redirect'] = request.redirectShrink;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateCloudResource',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Adds a service to Web Application Firewall (WAF). This operation is supported for only the Elastic Compute Service (ECS) and Classic Load Balancer (CLB) services.
 *
 * @param request CreateCloudResourceRequest
 * @return CreateCloudResourceResponse
 */
async function createCloudResource(request: CreateCloudResourceRequest): CreateCloudResourceResponse {
  var runtime = new $RuntimeOptions{};
  return createCloudResourceWithOptions(request, runtime);
}

model CreateDefenseResourceGroupRequest {
  addList?: string(name='AddList', description='The protected objects that you want to add to the protected object group. You can add multiple protected objects to a protected object group at the same time. You can specify multiple protected objects. Separate them with commas (,).', example='test1.aliyundoc.com,test2.aliyundoc.com'),
  description?: string(name='Description', description='The description of the protected object group.', example='test_domain'),
  groupName?: string(name='GroupName', description='The name of the protected object group that you want to create.

This parameter is required.', example='group221'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
}

model CreateDefenseResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='5D69B341-4F97-58E7-9E16-1B17FE7A9E98'),
}

model CreateDefenseResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDefenseResourceGroupResponseBody(name='body'),
}

/**
 * @summary Creates a protected object group.
 *
 * @param request CreateDefenseResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDefenseResourceGroupResponse
 */
async function createDefenseResourceGroupWithOptions(request: CreateDefenseResourceGroupRequest, runtime: $RuntimeOptions): CreateDefenseResourceGroupResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.addList)) {
    query['AddList'] = request.addList;
  }
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateDefenseResourceGroup',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a protected object group.
 *
 * @param request CreateDefenseResourceGroupRequest
 * @return CreateDefenseResourceGroupResponse
 */
async function createDefenseResourceGroup(request: CreateDefenseResourceGroupRequest): CreateDefenseResourceGroupResponse {
  var runtime = new $RuntimeOptions{};
  return createDefenseResourceGroupWithOptions(request, runtime);
}

model CreateDefenseRuleRequest {
  defenseScene?: string(name='DefenseScene', description='The module to which the protection rule that you want to create belongs.

*   **waf_group:** the basic protection rule module.
*   **antiscan:** the scan protection module.
*   **ip_blacklist:** the IP address blacklist module.
*   **custom_acl:** the custom rule module.
*   **whitelist:** the whitelist module.
*   **region_block:** the region blacklist module.
*   **custom_response:** the custom response module.
*   **cc:** the HTTP flood protection module.
*   **tamperproof:** the website tamper-proofing module.
*   **dlp:** the data leakage prevention module.

This parameter is required.', example='waf_group'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  rules?: string(name='Rules', description='This parameter is required.'),
  templateId?: long(name='TemplateId', description='The ID of the rule template for which you want to create a protection rule.', example='1122'),
}

model CreateDefenseRuleResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='26E46541-7AAB-5565-801D-F14DBDC5F186'),
  ruleIds?: string(name='RuleIds', description='The IDs of the protection rules. Multiple IDs are separated by commas (,).', example='22215,23354,462165'),
}

model CreateDefenseRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDefenseRuleResponseBody(name='body'),
}

/**
 * @summary Creates a protection rule.
 *
 * @param request CreateDefenseRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDefenseRuleResponse
 */
async function createDefenseRuleWithOptions(request: CreateDefenseRuleRequest, runtime: $RuntimeOptions): CreateDefenseRuleResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.defenseScene)) {
    query['DefenseScene'] = request.defenseScene;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var body : map[string]any = {};
  if (!$isNull(request.rules)) {
    body['Rules'] = request.rules;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateDefenseRule',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a protection rule.
 *
 * @param request CreateDefenseRuleRequest
 * @return CreateDefenseRuleResponse
 */
async function createDefenseRule(request: CreateDefenseRuleRequest): CreateDefenseRuleResponse {
  var runtime = new $RuntimeOptions{};
  return createDefenseRuleWithOptions(request, runtime);
}

model CreateDefenseTemplateRequest {
  defenseScene?: string(name='DefenseScene', description='The scenario in which you want to use the protection rule template. For more information, see the description of the **DefenseScene** parameter in the [CreateDefenseRule](~~CreateDefenseRule~~) topic.

This parameter is required.', example='waf_group'),
  description?: string(name='Description', description='The description of the protection rule template.', example='Test'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  templateName?: string(name='TemplateName', description='The name of the protection rule template.

This parameter is required.', example='test221'),
  templateOrigin?: string(name='TemplateOrigin', description='The origin of the protection rule template that you want to create. Set the value to **custom**. The value specifies that the protection rule template is a custom template.

This parameter is required.', example='custom'),
  templateStatus?: int32(name='TemplateStatus', description='The status of the protection rule template. Valid values:

*   **0:** disabled.
*   **1:** enabled.

This parameter is required.', example='1'),
  templateType?: string(name='TemplateType', description='The type of the protection rule template. Valid values:

*   **user_default:** default template.
*   **user_custom:** custom template.

This parameter is required.', example='user_default'),
}

model CreateDefenseTemplateResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='F48ABDF7-D777-5F26-892A-57349765D7A9'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template.', example='2212'),
}

model CreateDefenseTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDefenseTemplateResponseBody(name='body'),
}

/**
 * @summary Creates a protection rule template.
 *
 * @param request CreateDefenseTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDefenseTemplateResponse
 */
async function createDefenseTemplateWithOptions(request: CreateDefenseTemplateRequest, runtime: $RuntimeOptions): CreateDefenseTemplateResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.defenseScene)) {
    query['DefenseScene'] = request.defenseScene;
  }
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  if (!$isNull(request.templateOrigin)) {
    query['TemplateOrigin'] = request.templateOrigin;
  }
  if (!$isNull(request.templateStatus)) {
    query['TemplateStatus'] = request.templateStatus;
  }
  if (!$isNull(request.templateType)) {
    query['TemplateType'] = request.templateType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateDefenseTemplate',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a protection rule template.
 *
 * @param request CreateDefenseTemplateRequest
 * @return CreateDefenseTemplateResponse
 */
async function createDefenseTemplate(request: CreateDefenseTemplateRequest): CreateDefenseTemplateResponse {
  var runtime = new $RuntimeOptions{};
  return createDefenseTemplateWithOptions(request, runtime);
}

model CreateDomainRequest {
  accessType?: string(name='AccessType', description='The mode in which you want to add the domain name to WAF. Valid values:

*   **share:** adds the domain name to WAF in CNAME record mode. This is the default value.
*   **hybrid_cloud_cname:** adds the domain name to WAF in hybrid cloud reverse proxy mode.', example='share'),
  domain?: string(name='Domain', description='The domain name that you want to add to WAF.

This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  listen?: {
    certId?: string(name='CertId', description='The ID of the certificate that you want to add. This parameter is available only if you specify **HttpsPorts**.', example='123', nullable=true),
    cipherSuite?: int32(name='CipherSuite', description='The type of the cipher suites that you want to add. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **1**: all cipher suites.
*   **2**: strong cipher suites. This value is available only if you set **TLSVersion** to **tlsv1.2**.
*   **99**: custom cipher suites.', example='2'),
    customCiphers?: [ string ](name='CustomCiphers', description='The custom cipher suites that you want to add.'),
    enableTLSv3?: boolean(name='EnableTLSv3', description='Specifies whether to support TLS 1.3. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false**', example='true', nullable=true),
    exclusiveIp?: boolean(name='ExclusiveIp', description='Specifies whether to enable the exclusive IP address feature. This parameter is available only if you set **IPv6Enabled** to **false** and **ProtectionResource** to **share**. Valid values:

*   **true**
*   **false** (default)', example='true'),
    focusHttps?: boolean(name='FocusHttps', description='Specifies whether to enable force redirect from HTTP to HTTPS for received requests. This parameter is available only if you specify HttpsPorts and leave HttpPorts empty. Valid values:

*   **true**
*   **false**', example='true'),
    http2Enabled?: boolean(name='Http2Enabled', description='Specifies whether to enable HTTP/2. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false** (default)', example='true'),
    httpPorts?: [ int32 ](name='HttpPorts', description='The HTTP listener ports.'),
    httpsPorts?: [ int32 ](name='HttpsPorts', description='The HTTPS listener ports.'),
    IPv6Enabled?: boolean(name='IPv6Enabled', description='Specifies whether to enable IPv6 protection. Valid values:

*   **true**
*   **false** (default)', example='true'),
    protectionResource?: string(name='ProtectionResource', description='The type of the protection resource. Valid values:

*   **share** (default): a shared cluster.
*   **gslb**: shared cluster-based intelligent load balancing.', example='share'),
    SM2AccessOnly?: boolean(name='SM2AccessOnly', description='Specifies whether to allow access only from SM certificate-based clients. This parameter is available only if you set SM2Enabled to true.

*   true
*   false', example='true', nullable=true),
    SM2CertId?: string(name='SM2CertId', description='The ID of the SM certificate that you want to add. This parameter is available only if you set SM2Enabled to true.', example='123-cn-hangzhou', nullable=true),
    SM2Enabled?: boolean(name='SM2Enabled', description='Specifies whether to add an SM certificate.', example='true', nullable=true),
    TLSVersion?: string(name='TLSVersion', description='The Transport Layer Security (TLS) version that you want to add. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **tlsv1**
*   **tlsv1.1**
*   **tlsv1.2**', example='tlsv1'),
    xffHeaderMode?: int32(name='XffHeaderMode', description='The method that is used to obtain the originating IP address of a client. Valid values:

*   **0** (default): Client traffic is not filtered by a Layer 7 proxy before the traffic reaches WAF.
*   **1**: WAF reads the first value of the X-Forwarded-For (XFF) header field as the originating IP address of the client.
*   **2**: WAF reads the value of a custom header field as the originating IP address of the client.', example='1'),
    xffHeaders?: [ string ](name='XffHeaders', description='The custom header fields that are used to obtain the originating IP address of a client.'),
  }(name='Listen', description='The listener configurations.

This parameter is required.'),
  redirect?: {
    backends?: [ string ](name='Backends', description='The IP addresses or domain names of the origin server.'),
    backupBackends?: [ string ](name='BackupBackends', description='The secondary IP addresses or domain names of the origin server.'),
    cnameEnabled?: boolean(name='CnameEnabled', description='Specifies whether to enable the public cloud disaster recovery feature. Valid values:

*   **true**
*   **false** (default)', example='true'),
    connectTimeout?: int32(name='ConnectTimeout', description='The timeout period of connections. Unit: seconds. Valid values: 1 to 3600.', example='120'),
    focusHttpBackend?: boolean(name='FocusHttpBackend', description='Specifies whether to enable force redirect from HTTPS to HTTP for back-to-origin requests. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false**', example='true'),
    keepalive?: boolean(name='Keepalive', description='Specifies whether to enable the persistent connection feature. Valid values:

*   **true** (default)
*   **false**', example='true'),
    keepaliveRequests?: int32(name='KeepaliveRequests', description='The number of reused persistent connections. Valid values: 60 to 1000.

>  This parameter specifies the number of persistent connections that can be reused after you enable the persistent connection feature.', example='1000'),
    keepaliveTimeout?: int32(name='KeepaliveTimeout', description='The timeout period of idle persistent connections. Valid values: 1 to 60. Default value: 15. Unit: seconds.

>  This parameter specifies the period of time after which an idle persistent connection is closed.', example='15'),
    loadbalance?: string(name='Loadbalance', description='The load balancing algorithm that you want to use to forward requests to the origin server. Valid values:

*   **iphash**
*   **roundRobin**
*   **leastTime**: This value is available only if you set **ProtectionResource** to **gslb**.

This parameter is required.', example='roundRobin'),
    readTimeout?: int32(name='ReadTimeout', description='The timeout period of read connections. Unit: seconds. Valid values: 1 to 3600.', example='200'),
    requestHeaders?: [ 
      {
        key?: string(name='Key', description='The key of the custom header field.', example='aaa'),
        value?: string(name='Value', description='The value of the custom header field.', example='bbb'),
      }
    ](name='RequestHeaders', description='The custom header fields, which are key-value pairs. The fields are used to mark requests that pass through WAF.

When a request passes through WAF, WAF automatically adds the custom header fields to the request to mark the request. This way, the backend service can identify requests that are processed by WAF.'),
    retry?: boolean(name='Retry', description='Specifies whether WAF retries if WAF fails to forward requests to the origin server. Valid values:

*   **true** (default)
*   **false**', example='true'),
    routingRules?: string(name='RoutingRules', description='The forwarding rules for the hybrid cloud mode. The value is a string that consists of JSON arrays. Each element in a JSON array is a JSON struct that contains the following fields:

*   **rs**: the back-to-origin IP addresses or CNAMEs. Data type: array.
*   **location**: the name of the protection node. Data type: string.
*   **locationId**: the ID of the protection node. Data type: long.', example='[
      {
            "rs": [
                  "1.1.XX.XX"
            ],
            "locationId": 535,
            "location": "test1111"
      }
]'),
    sniEnabled?: boolean(name='SniEnabled', description='Specifies whether to enable the Server Name Indication (SNI) feature for back-to-origin requests. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false** (default)', example='true'),
    sniHost?: string(name='SniHost', description='The custom value of the SNI field. If you do not specify this parameter, the value of the **Host** header field is automatically used. In most cases, you do not need to specify a custom value for the SNI field. However, if you want WAF to use an SNI field whose value is different from the value of the Host header field in back-to-origin requests, you can specify a custom value for the SNI field.

>  This parameter is required only if you set **SniEnabled** to **true**.', example='www.aliyundoc.com'),
    writeTimeout?: int32(name='WriteTimeout', description='The timeout period of write connections. Unit: seconds. Valid values: 1 to 3600.', example='200'),
    xffProto?: boolean(name='XffProto', description='Specifies whether to use the X-Forward-For-Proto header field to pass the protocol used by WAF to forward requests to the origin server. Valid values:

*   **true** (default)
*   **false**', example='true'),
  }(name='Redirect', description='The forwarding configurations.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou**: the Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland

This parameter is required.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.', example='Tagkey1'),
      value?: string(name='Value', description='The value of the tag.', example='TagValue1'),
    }
  ](name='Tag', description='The tags. You can specify up to 20 tags.'),
}

model CreateDomainShrinkRequest {
  accessType?: string(name='AccessType', description='The mode in which you want to add the domain name to WAF. Valid values:

*   **share:** adds the domain name to WAF in CNAME record mode. This is the default value.
*   **hybrid_cloud_cname:** adds the domain name to WAF in hybrid cloud reverse proxy mode.', example='share'),
  domain?: string(name='Domain', description='The domain name that you want to add to WAF.

This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  listenShrink?: string(name='Listen', description='The listener configurations.

This parameter is required.'),
  redirectShrink?: string(name='Redirect', description='The forwarding configurations.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou**: the Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland

This parameter is required.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of the tag.', example='Tagkey1'),
      value?: string(name='Value', description='The value of the tag.', example='TagValue1'),
    }
  ](name='Tag', description='The tags. You can specify up to 20 tags.'),
}

model CreateDomainResponseBody = {
  domainInfo?: {
    cname?: string(name='Cname', description='The CNAME that is assigned by WAF to the domain name.', example='xxxxxwww.****.com'),
    domain?: string(name='Domain', description='The domain name that you added to WAF.', example='www.aliyundoc.com'),
    domainId?: string(name='DomainId', description='The name of the protected object that is generated.', example='www.aliyundoc.com-waf'),
  }(name='DomainInfo', description='The information about the domain name that is added.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19160D****'),
}

model CreateDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDomainResponseBody(name='body'),
}

/**
 * @summary Adds a domain name to Web Application Firewall (WAF).
 *
 * @param tmpReq CreateDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDomainResponse
 */
async function createDomainWithOptions(tmpReq: CreateDomainRequest, runtime: $RuntimeOptions): CreateDomainResponse {
  tmpReq.validate();
  var request = new CreateDomainShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.listen)) {
    request.listenShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.listen, 'Listen', 'json');
  }
  if (!$isNull(tmpReq.redirect)) {
    request.redirectShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.redirect, 'Redirect', 'json');
  }
  var query = {};
  if (!$isNull(request.accessType)) {
    query['AccessType'] = request.accessType;
  }
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.listenShrink)) {
    query['Listen'] = request.listenShrink;
  }
  if (!$isNull(request.redirectShrink)) {
    query['Redirect'] = request.redirectShrink;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateDomain',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Adds a domain name to Web Application Firewall (WAF).
 *
 * @param request CreateDomainRequest
 * @return CreateDomainResponse
 */
async function createDomain(request: CreateDomainRequest): CreateDomainResponse {
  var runtime = new $RuntimeOptions{};
  return createDomainWithOptions(request, runtime);
}

model CreateHybridCloudGroupRequest {
  backSourceMark?: string(name='BackSourceMark', description='The region in which the node resides. Specify the parameter in the Carrier code-Continent code-City code format.', example='aliyun-asiapacific-beijing'),
  clusterId?: long(name='ClusterId', description='The ID of the hybrid cloud cluster.

This parameter is required.', example='1'),
  groupName?: string(name='GroupName', description='The name of the node group.

This parameter is required.', example='demoGroupName'),
  groupType?: string(name='GroupType', description='The type of the node group. Valid values:

*   **protect**
*   **control**
*   **storage**
*   **controlStorage**

This parameter is required.', example='protect'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-n6w***x52m'),
  loadBalanceIp?: string(name='LoadBalanceIp', description='The IP address of the server used for load balancing.

This parameter is required.', example='3.3.3.3'),
  locationCode?: string(name='LocationCode', description='The region in which the node resides. Specify the parameter in the Carrier code-Continent code-City code format.', example='0-410-0'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The remarks.', example='demoRamark'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model CreateHybridCloudGroupResponseBody = {
  data?: long(name='Data', description='The ID of the node group.', example='1'),
  requestId?: string(name='RequestId', description='The request ID.', example='48F7C7BA-0932-50EA-89AD-5B0E1***274'),
}

model CreateHybridCloudGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateHybridCloudGroupResponseBody(name='body'),
}

/**
 * @summary Creates a node group for a hybrid cloud cluster.
 *
 * @param request CreateHybridCloudGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateHybridCloudGroupResponse
 */
async function createHybridCloudGroupWithOptions(request: CreateHybridCloudGroupRequest, runtime: $RuntimeOptions): CreateHybridCloudGroupResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.backSourceMark)) {
    query['BackSourceMark'] = request.backSourceMark;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!$isNull(request.groupType)) {
    query['GroupType'] = request.groupType;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.loadBalanceIp)) {
    query['LoadBalanceIp'] = request.loadBalanceIp;
  }
  if (!$isNull(request.locationCode)) {
    query['LocationCode'] = request.locationCode;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateHybridCloudGroup',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a node group for a hybrid cloud cluster.
 *
 * @param request CreateHybridCloudGroupRequest
 * @return CreateHybridCloudGroupResponse
 */
async function createHybridCloudGroup(request: CreateHybridCloudGroupRequest): CreateHybridCloudGroupResponse {
  var runtime = new $RuntimeOptions{};
  return createHybridCloudGroupWithOptions(request, runtime);
}

model CreateMajorProtectionBlackIpRequest {
  description?: string(name='Description', description='The description of the IP address blacklist.', example='Protection for major events'),
  expiredTime?: long(name='ExpiredTime', description='The timestamp after which the IP address blacklist becomes invalid. Unit: seconds.

>  If you set the parameter to **0**, the IP address blacklist is always valid.

This parameter is required.', example='1716528465'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-2r42s6y****'),
  ipList?: string(name='IpList', description='The IP addresses that you want to add to the IP address blacklist. CIDR blocks and IP addresses are supported. IPv4 and IPv6 addresses are supported. Separate the CIDR blocks or IP addresses with commas (,). For more information, see [Protection for major events](https://help.aliyun.com/document_detail/425591.html).

This parameter is required.', example='192.0.XX.XX,192.0.XX.XX/24'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleId?: long(name='RuleId', description='The ID of the IP address blacklist rule for major event protection.

This parameter is required.', example='232324'),
  templateId?: long(name='TemplateId', description='The ID of the IP address blacklist rule template for major event protection.

This parameter is required.', example='2221'),
}

model CreateMajorProtectionBlackIpResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D****'),
}

model CreateMajorProtectionBlackIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateMajorProtectionBlackIpResponseBody(name='body'),
}

/**
 * @summary Creates an IP address blacklist for major event protection.
 *
 * @description This operation is available only on the China site (aliyun.com).
 *
 * @param request CreateMajorProtectionBlackIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateMajorProtectionBlackIpResponse
 */
async function createMajorProtectionBlackIpWithOptions(request: CreateMajorProtectionBlackIpRequest, runtime: $RuntimeOptions): CreateMajorProtectionBlackIpResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.expiredTime)) {
    query['ExpiredTime'] = request.expiredTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.ipList)) {
    query['IpList'] = request.ipList;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateMajorProtectionBlackIp',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates an IP address blacklist for major event protection.
 *
 * @description This operation is available only on the China site (aliyun.com).
 *
 * @param request CreateMajorProtectionBlackIpRequest
 * @return CreateMajorProtectionBlackIpResponse
 */
async function createMajorProtectionBlackIp(request: CreateMajorProtectionBlackIpRequest): CreateMajorProtectionBlackIpResponse {
  var runtime = new $RuntimeOptions{};
  return createMajorProtectionBlackIpWithOptions(request, runtime);
}

model CreateMemberAccountsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  memberAccountIds?: [ string ](name='MemberAccountIds', description='The Alibaba Cloud account IDs of the members that you want to add. You can add up to 10 members at the same time.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  sourceIp?: string(name='SourceIp', description='The source IP address of the request. The system automatically obtains the value of this parameter.', example='1.1.X.X'),
}

model CreateMemberAccountsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='66A98669-ER12-WE34-23PO-301469*****E'),
}

model CreateMemberAccountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateMemberAccountsResponseBody(name='body'),
}

/**
 * @summary Adds members to use the multi-account management feature of Web Application Firewall (WAF).
 *
 * @param request CreateMemberAccountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateMemberAccountsResponse
 */
async function createMemberAccountsWithOptions(request: CreateMemberAccountsRequest, runtime: $RuntimeOptions): CreateMemberAccountsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.memberAccountIds)) {
    query['MemberAccountIds'] = request.memberAccountIds;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateMemberAccounts',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Adds members to use the multi-account management feature of Web Application Firewall (WAF).
 *
 * @param request CreateMemberAccountsRequest
 * @return CreateMemberAccountsResponse
 */
async function createMemberAccounts(request: CreateMemberAccountsRequest): CreateMemberAccountsResponse {
  var runtime = new $RuntimeOptions{};
  return createMemberAccountsWithOptions(request, runtime);
}

model CreatePostpaidInstanceRequest {
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm4gh****wela'),
}

model CreatePostpaidInstanceResponseBody = {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.', example='waf_v2_public_cn-x0r****gr1i'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='73A4E786-8235-50C0-9631-87C8****4A36'),
}

model CreatePostpaidInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreatePostpaidInstanceResponseBody(name='body'),
}

/**
 * @summary Creates a pay-as-you-go Web Application Firewall (WAF) 3.0 instance.
 *
 * @param request CreatePostpaidInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreatePostpaidInstanceResponse
 */
async function createPostpaidInstanceWithOptions(request: CreatePostpaidInstanceRequest, runtime: $RuntimeOptions): CreatePostpaidInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreatePostpaidInstance',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a pay-as-you-go Web Application Firewall (WAF) 3.0 instance.
 *
 * @param request CreatePostpaidInstanceRequest
 * @return CreatePostpaidInstanceResponse
 */
async function createPostpaidInstance(request: CreatePostpaidInstanceRequest): CreatePostpaidInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return createPostpaidInstanceWithOptions(request, runtime);
}

model CreateSM2CertRequest {
  certName?: string(name='CertName', description='The name of the SM certificate.', example='test-sm2'),
  encryptCertificate?: string(name='EncryptCertificate', description='The content of the SM certificate.', example='-----BEGIN CERTIFICATE-----
***
-----END CERTIFICATE-----'),
  encryptPrivateKey?: string(name='EncryptPrivateKey', description='The private key of the SM certificate.', example='-----BEGIN PRIVATE KEY-----
***
-----END PRIVATE KEY-----'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  signCertificate?: string(name='SignCertificate', description='The content of the signing certificate for the SM certificate.', example='-----BEGIN CERTIFICATE-----
***
-----END CERTIFICATE-----'),
  signPrivateKey?: string(name='SignPrivateKey', description='The private key of the signing certificate for the SM certificate.', example='-----BEGIN PRIVATE KEY-----
***
-----END PRIVATE KEY-----'),
}

model CreateSM2CertResponseBody = {
  certIdentifier?: string(name='CertIdentifier', description='The ID of the certificate.', example='***-cn-hangzhou'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-***'),
}

model CreateSM2CertResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSM2CertResponseBody(name='body'),
}

/**
 * @summary Uploads a ShangMi (SM) certificate for a domain name that is added to Web Application Firewall (WAF) in CNAME record mode.
 *
 * @param request CreateSM2CertRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSM2CertResponse
 */
async function createSM2CertWithOptions(request: CreateSM2CertRequest, runtime: $RuntimeOptions): CreateSM2CertResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.certName)) {
    query['CertName'] = request.certName;
  }
  if (!$isNull(request.encryptCertificate)) {
    query['EncryptCertificate'] = request.encryptCertificate;
  }
  if (!$isNull(request.encryptPrivateKey)) {
    query['EncryptPrivateKey'] = request.encryptPrivateKey;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.signCertificate)) {
    query['SignCertificate'] = request.signCertificate;
  }
  if (!$isNull(request.signPrivateKey)) {
    query['SignPrivateKey'] = request.signPrivateKey;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'CreateSM2Cert',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Uploads a ShangMi (SM) certificate for a domain name that is added to Web Application Firewall (WAF) in CNAME record mode.
 *
 * @param request CreateSM2CertRequest
 * @return CreateSM2CertResponse
 */
async function createSM2Cert(request: CreateSM2CertRequest): CreateSM2CertResponse {
  var runtime = new $RuntimeOptions{};
  return createSM2CertWithOptions(request, runtime);
}

model DeleteApisecAbnormalsRequest {
  abnormalIds?: [ string ](name='AbnormalIds', description='The risk IDs.

This parameter is required.'),
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-nwy*****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='阿里云资源组ID。', example='rg-acfm***q'),
}

model DeleteApisecAbnormalsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model DeleteApisecAbnormalsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteApisecAbnormalsResponseBody(name='body'),
}

/**
 * @summary Deletes multiple risks detected by the API security module at a time.
 *
 * @param request DeleteApisecAbnormalsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteApisecAbnormalsResponse
 */
async function deleteApisecAbnormalsWithOptions(request: DeleteApisecAbnormalsRequest, runtime: $RuntimeOptions): DeleteApisecAbnormalsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.abnormalIds)) {
    query['AbnormalIds'] = request.abnormalIds;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteApisecAbnormals',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes multiple risks detected by the API security module at a time.
 *
 * @param request DeleteApisecAbnormalsRequest
 * @return DeleteApisecAbnormalsResponse
 */
async function deleteApisecAbnormals(request: DeleteApisecAbnormalsRequest): DeleteApisecAbnormalsResponse {
  var runtime = new $RuntimeOptions{};
  return deleteApisecAbnormalsWithOptions(request, runtime);
}

model DeleteApisecEventsRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  eventIds?: [ string ](name='EventIds', description='The IDs of the security events.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-g4t*****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='阿里云资源组ID。', example='rg-acfm***q'),
}

model DeleteApisecEventsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model DeleteApisecEventsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteApisecEventsResponseBody(name='body'),
}

/**
 * @summary Deletes multiple security events detected by the API security module at a time.
 *
 * @param request DeleteApisecEventsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteApisecEventsResponse
 */
async function deleteApisecEventsWithOptions(request: DeleteApisecEventsRequest, runtime: $RuntimeOptions): DeleteApisecEventsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.eventIds)) {
    query['EventIds'] = request.eventIds;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteApisecEvents',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes multiple security events detected by the API security module at a time.
 *
 * @param request DeleteApisecEventsRequest
 * @return DeleteApisecEventsResponse
 */
async function deleteApisecEvents(request: DeleteApisecEventsRequest): DeleteApisecEventsResponse {
  var runtime = new $RuntimeOptions{};
  return deleteApisecEventsWithOptions(request, runtime);
}

model DeleteCloudResourceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-***'),
  port?: int32(name='Port', description='The port of the resource that is added to WAF.

This parameter is required.', example='443'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceInstanceId?: string(name='ResourceInstanceId', description='The ID of the instance.

This parameter is required.', example='lb-bp1*****jqnnqk5uj2p'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  resourceProduct?: string(name='ResourceProduct', description='The cloud service. Valid values:

*   **clb4**: Layer 4 CLB.
*   **clb7**: Layer 7 CLB.
*   **ecs**: ECS.

This parameter is required.', example='clb7'),
}

model DeleteCloudResourceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-***'),
}

model DeleteCloudResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteCloudResourceResponseBody(name='body'),
}

/**
 * @summary Removes a service from Web Application Firewall (WAF). This operation is supported for only the Elastic Compute Service (ECS) and Classic Load Balancer (CLB) services.
 *
 * @param request DeleteCloudResourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteCloudResourceResponse
 */
async function deleteCloudResourceWithOptions(request: DeleteCloudResourceRequest, runtime: $RuntimeOptions): DeleteCloudResourceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.port)) {
    query['Port'] = request.port;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceInstanceId)) {
    query['ResourceInstanceId'] = request.resourceInstanceId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceProduct)) {
    query['ResourceProduct'] = request.resourceProduct;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteCloudResource',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Removes a service from Web Application Firewall (WAF). This operation is supported for only the Elastic Compute Service (ECS) and Classic Load Balancer (CLB) services.
 *
 * @param request DeleteCloudResourceRequest
 * @return DeleteCloudResourceResponse
 */
async function deleteCloudResource(request: DeleteCloudResourceRequest): DeleteCloudResourceResponse {
  var runtime = new $RuntimeOptions{};
  return deleteCloudResourceWithOptions(request, runtime);
}

model DeleteDefenseResourceGroupRequest {
  groupName?: string(name='GroupName', description='The name of the protected object group that you want to delete.

This parameter is required.', example='group221'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
}

model DeleteDefenseResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='25BE1169-9AE4-5D7D-8293-C33242ABB549'),
}

model DeleteDefenseResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDefenseResourceGroupResponseBody(name='body'),
}

/**
 * @summary Deletes a protected object group.
 *
 * @param request DeleteDefenseResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDefenseResourceGroupResponse
 */
async function deleteDefenseResourceGroupWithOptions(request: DeleteDefenseResourceGroupRequest, runtime: $RuntimeOptions): DeleteDefenseResourceGroupResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteDefenseResourceGroup',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a protected object group.
 *
 * @param request DeleteDefenseResourceGroupRequest
 * @return DeleteDefenseResourceGroupResponse
 */
async function deleteDefenseResourceGroup(request: DeleteDefenseResourceGroupRequest): DeleteDefenseResourceGroupResponse {
  var runtime = new $RuntimeOptions{};
  return deleteDefenseResourceGroupWithOptions(request, runtime);
}

model DeleteDefenseRuleRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleIds?: string(name='RuleIds', description='The IDs of the protection rules that you want to delete. Separate the IDs with commas (,).

This parameter is required.', example='2223455,23354,465565'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template to which the protection rule that you want to delete belongs.', example='2221'),
}

model DeleteDefenseRuleResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='2EC856FE-6D31-5861-8275-E5DEDB539089'),
}

model DeleteDefenseRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDefenseRuleResponseBody(name='body'),
}

/**
 * @summary Deletes a protection rule.
 *
 * @param request DeleteDefenseRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDefenseRuleResponse
 */
async function deleteDefenseRuleWithOptions(request: DeleteDefenseRuleRequest, runtime: $RuntimeOptions): DeleteDefenseRuleResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleIds)) {
    query['RuleIds'] = request.ruleIds;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteDefenseRule',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a protection rule.
 *
 * @param request DeleteDefenseRuleRequest
 * @return DeleteDefenseRuleResponse
 */
async function deleteDefenseRule(request: DeleteDefenseRuleRequest): DeleteDefenseRuleResponse {
  var runtime = new $RuntimeOptions{};
  return deleteDefenseRuleWithOptions(request, runtime);
}

model DeleteDefenseTemplateRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template that you want to delete.

This parameter is required.', example='3155'),
}

model DeleteDefenseTemplateResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='E2DE6F11-6FED-5909-95F2-2520B58C5BC7'),
}

model DeleteDefenseTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDefenseTemplateResponseBody(name='body'),
}

/**
 * @summary Deletes a protection rule template.
 *
 * @param request DeleteDefenseTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDefenseTemplateResponse
 */
async function deleteDefenseTemplateWithOptions(request: DeleteDefenseTemplateRequest, runtime: $RuntimeOptions): DeleteDefenseTemplateResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteDefenseTemplate',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a protection rule template.
 *
 * @param request DeleteDefenseTemplateRequest
 * @return DeleteDefenseTemplateResponse
 */
async function deleteDefenseTemplate(request: DeleteDefenseTemplateRequest): DeleteDefenseTemplateResponse {
  var runtime = new $RuntimeOptions{};
  return deleteDefenseTemplateWithOptions(request, runtime);
}

model DeleteDomainRequest {
  accessType?: string(name='AccessType', description='The mode in which the domain name is added to WAF. Valid values:

*   **share:** CNAME record mode. This is the default value.
*   **hybrid_cloud_cname:** hybrid cloud reverse proxy mode.', example='share'),
  domain?: string(name='Domain', description='The domain name that you want to delete.

This parameter is required.', example='www.aliyundoc.com'),
  domainId?: string(name='DomainId', description='The ID of the domain name.', example='www.aliyundoc.com-waf'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
}

model DeleteDomainResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DeleteDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDomainResponseBody(name='body'),
}

/**
 * @summary Deletes a domain name that is added to Web Application Firewall (WAF).
 *
 * @param request DeleteDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDomainResponse
 */
async function deleteDomainWithOptions(request: DeleteDomainRequest, runtime: $RuntimeOptions): DeleteDomainResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accessType)) {
    query['AccessType'] = request.accessType;
  }
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.domainId)) {
    query['DomainId'] = request.domainId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteDomain',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a domain name that is added to Web Application Firewall (WAF).
 *
 * @param request DeleteDomainRequest
 * @return DeleteDomainResponse
 */
async function deleteDomain(request: DeleteDomainRequest): DeleteDomainResponse {
  var runtime = new $RuntimeOptions{};
  return deleteDomainWithOptions(request, runtime);
}

model DeleteMajorProtectionBlackIpRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  ipList?: string(name='IpList', description='The IP address blacklist for major event protection that you want to delete. You can specify multiple CIDR blocks or IP addresses. IPv4 and IPv6 addresses are supported. Separate the CIDR blocks or IP addresses with commas (,). For more information, see [Protection for major events](https://help.aliyun.com/document_detail/425591.html).

This parameter is required.', example='192.0.XX.XX,192.0.XX.XX/24'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleId?: long(name='RuleId', description='The ID of the IP address blacklist rule for major event protection.

This parameter is required.', example='20013135'),
  templateId?: long(name='TemplateId', description='The ID of the IP address blacklist rule template for major event protection.

This parameter is required.', example='5332'),
}

model DeleteMajorProtectionBlackIpResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='66A98669-CC6E-4F3E-80A6-3014697B11AE'),
}

model DeleteMajorProtectionBlackIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteMajorProtectionBlackIpResponseBody(name='body'),
}

/**
 * @summary Deletes an IP address blacklist for major event protection.
 *
 * @param request DeleteMajorProtectionBlackIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteMajorProtectionBlackIpResponse
 */
async function deleteMajorProtectionBlackIpWithOptions(request: DeleteMajorProtectionBlackIpRequest, runtime: $RuntimeOptions): DeleteMajorProtectionBlackIpResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.ipList)) {
    query['IpList'] = request.ipList;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteMajorProtectionBlackIp',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes an IP address blacklist for major event protection.
 *
 * @param request DeleteMajorProtectionBlackIpRequest
 * @return DeleteMajorProtectionBlackIpResponse
 */
async function deleteMajorProtectionBlackIp(request: DeleteMajorProtectionBlackIpRequest): DeleteMajorProtectionBlackIpResponse {
  var runtime = new $RuntimeOptions{};
  return deleteMajorProtectionBlackIpWithOptions(request, runtime);
}

model DeleteMemberAccountRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_esasdf3****'),
  memberAccountId?: string(name='MemberAccountId', description='The Alibaba Cloud account ID of the managed member.

This parameter is required.', example='131***********39'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  sourceIp?: string(name='SourceIp', description='The source IP address of the request. The system automatically obtains the value of this parameter.', example='0.0.XX.XX'),
}

model DeleteMemberAccountResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='5ABE714C-8890-5D7E-A08B-45CB****5473'),
}

model DeleteMemberAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteMemberAccountResponseBody(name='body'),
}

/**
 * @summary Removes the members that are added for multi-account management in Web Application Firewall (WAF).
 *
 * @param request DeleteMemberAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteMemberAccountResponse
 */
async function deleteMemberAccountWithOptions(request: DeleteMemberAccountRequest, runtime: $RuntimeOptions): DeleteMemberAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.memberAccountId)) {
    query['MemberAccountId'] = request.memberAccountId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DeleteMemberAccount',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Removes the members that are added for multi-account management in Web Application Firewall (WAF).
 *
 * @param request DeleteMemberAccountRequest
 * @return DeleteMemberAccountResponse
 */
async function deleteMemberAccount(request: DeleteMemberAccountRequest): DeleteMemberAccountResponse {
  var runtime = new $RuntimeOptions{};
  return deleteMemberAccountWithOptions(request, runtime);
}

model DescribeAccountDelegatedStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeAccountDelegatedStatusResponseBody = {
  accountId?: string(name='AccountId', description='The ID of the Alibaba Cloud account.', example='10***********34'),
  accountName?: string(name='AccountName', description='The name of the Alibaba Cloud account. This parameter is returned only if the account is the delegated administrator account.', example='account_test'),
  delegatedStatus?: boolean(name='DelegatedStatus', description='Indicates whether the Alibaba Cloud account is the delegated administrator account of the WAF instance.

*   **true**
*   **false**', example='true'),
  requestId?: string(name='RequestId', description='The request ID.', example='8161375D-5958-5627-BFDE-DF14****3E87'),
}

model DescribeAccountDelegatedStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeAccountDelegatedStatusResponseBody(name='body'),
}

/**
 * @summary Queries whether an Alibaba Cloud account is the delegated administrator account of a Web Application Firewall (WAF) instance.
 *
 * @param request DescribeAccountDelegatedStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeAccountDelegatedStatusResponse
 */
async function describeAccountDelegatedStatusWithOptions(request: DescribeAccountDelegatedStatusRequest, runtime: $RuntimeOptions): DescribeAccountDelegatedStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeAccountDelegatedStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries whether an Alibaba Cloud account is the delegated administrator account of a Web Application Firewall (WAF) instance.
 *
 * @param request DescribeAccountDelegatedStatusRequest
 * @return DescribeAccountDelegatedStatusResponse
 */
async function describeAccountDelegatedStatus(request: DescribeAccountDelegatedStatusRequest): DescribeAccountDelegatedStatusResponse {
  var runtime = new $RuntimeOptions{};
  return describeAccountDelegatedStatusWithOptions(request, runtime);
}

model DescribeApiExportsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-p****'),
  lang?: string(name='Lang', description='Language type. Valid values:

- **cn**: Chinese.
- **en**: English.', example='zh'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries to return on each page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the Web Application Firewall (WAF) instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeApiExportsResponseBody = {
  apiExports?: [ 
    {
      createTime?: long(name='CreateTime', description='The time when the data export task was created. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1725604852'),
      fileName?: string(name='FileName', description='The name of the file.', example='file_16109541456445334c0f01d9a7444e0e908***.csv'),
      fileUrl?: string(name='FileUrl', description='The download URL of the exported file.', example='https://waf-api-sec-cn.***.aliyuncs.com/file_1610954145***.csv'),
      format?: string(name='Format', description='The format of the exported file.', example='CSV'),
      status?: string(name='Status', description='The status of the data export task. Valid values:

* **expired**: The file is expired.

* **exporting**: Data is being exported.

* **completed**: Data is exported.', example='completed'),
      type?: string(name='Type', description='The type of the data export task. Valid values:

* **apisec_api**: API tasks

* **apisec_abnormal**: API risk tasks

* **apisec_event**: API security event tasks', example='apisec_api'),
    }
  ](name='ApiExports', description='The returned data export tasks.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D9532525-E885-54E7-A178-D5554D563AFB'),
  total?: long(name='Total', description='The status of the data export task. Valid values:

*   **expired**: The file is expired.
*   **exporting**: Data is being exported.
*   **completed**: Data is exported.', example='7'),
}

model DescribeApiExportsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApiExportsResponseBody(name='body'),
}

/**
 * @summary Queries the list of data export tasks in the API security module.
 *
 * @param request DescribeApiExportsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApiExportsResponse
 */
async function describeApiExportsWithOptions(request: DescribeApiExportsRequest, runtime: $RuntimeOptions): DescribeApiExportsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.lang)) {
    query['Lang'] = request.lang;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApiExports',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the list of data export tasks in the API security module.
 *
 * @param request DescribeApiExportsRequest
 * @return DescribeApiExportsResponse
 */
async function describeApiExports(request: DescribeApiExportsRequest): DescribeApiExportsResponse {
  var runtime = new $RuntimeOptions{};
  return describeApiExportsWithOptions(request, runtime);
}

model DescribeApisecAbnormalDomainStatisticRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  endTime?: long(name='EndTime', description='The end of the time range to query. Specify a UNIX timestamp in UTC. Unit: seconds.', example='1687313820'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-45919n***'),
  orderWay?: string(name='OrderWay', description='The sorting order. Valid values:

- **asc**: ascending order.
- **desc**: descending order.', example='desc'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **5**.', example='5'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. Specify a UNIX timestamp in UTC. Unit: seconds.', example='1682571600'),
}

model DescribeApisecAbnormalDomainStatisticResponseBody = {
  data?: [ 
    {
      apiCount?: long(name='ApiCount', description='The number of APIs.', example='10'),
      domain?: string(name='Domain', description='The domain name.', example='ba.aliyun.com'),
      high?: long(name='High', description='The number of high-level risks.', example='12'),
      low?: long(name='Low', description='The number of low-level risks.', example='4'),
      medium?: long(name='Medium', description='The number of medium-level risks.', example='9'),
    }
  ](name='Data', description='The response parameters.'),
  requestId?: string(name='RequestId', description='Id of the request.', example='66A98669-CC6E-4F3E-80A6-3014***B11AE'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model DescribeApisecAbnormalDomainStatisticResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecAbnormalDomainStatisticResponseBody(name='body'),
}

/**
 * @summary Queries the statistics on domain names on which risks are detected by the API security module.
 *
 * @param request DescribeApisecAbnormalDomainStatisticRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecAbnormalDomainStatisticResponse
 */
async function describeApisecAbnormalDomainStatisticWithOptions(request: DescribeApisecAbnormalDomainStatisticRequest, runtime: $RuntimeOptions): DescribeApisecAbnormalDomainStatisticResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.orderWay)) {
    query['OrderWay'] = request.orderWay;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecAbnormalDomainStatistic',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the statistics on domain names on which risks are detected by the API security module.
 *
 * @param request DescribeApisecAbnormalDomainStatisticRequest
 * @return DescribeApisecAbnormalDomainStatisticResponse
 */
async function describeApisecAbnormalDomainStatistic(request: DescribeApisecAbnormalDomainStatisticRequest): DescribeApisecAbnormalDomainStatisticResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecAbnormalDomainStatisticWithOptions(request, runtime);
}

model DescribeApisecAbnormalsRequest {
  abnormalId?: string(name='AbnormalId', description='The ID of the risk.', example='29c6401****99a2bad3943e26d8'),
  abnormalLevel?: string(name='AbnormalLevel', description='The level of the risk. Valid values:

* **high**
* **medium**
* **low**', example='medium'),
  abnormalTag?: string(name='AbnormalTag', description='The type of the risk.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of risks.', example='LackOfSpeedLimit'),
  apiFormat?: string(name='ApiFormat', description='The risk-related API.', example='/api/users/login'),
  apiId?: string(name='ApiId', description='The ID of the risk-related API.', example='bd9efb8ad******d9ca6'),
  apiTag?: string(name='ApiTag', description='The business purpose of the API.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the business purposes of APIs.', example='RegisterAPI'),
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.

>  This parameter is available only in hybrid cloud scenarios. You can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query hybrid cloud clusters.', example='546'),
  endTime?: string(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1684382100'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-z***9g301'),
  matchedHost?: string(name='MatchedHost', description='The domain name or IP address of the API.', example='a.aliyun.com'),
  orderKey?: string(name='OrderKey', description='The name of the sorting field. Valid values:

*   **discoverTime** (default): indicates the time when a risk was first detected.
*   **abnormalLevel**: indicates the level of a risk.
*   **latestDiscoverTime**: indicates the time when a risk was last detected.', example='allCnt'),
  orderWay?: string(name='OrderWay', description='The sorting method. Valid values:

* **desc (default)**: in descending order
* **asc**: in ascending order', example='desc'),
  origin?: string(name='Origin', description='The source of the risk type. Valid values:

* **custom**
* **default**', example='custom'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='2'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-qingdao'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1684252800'),
  userStatus?: string(name='UserStatus', description='The status of the risk. Valid values:

* **toBeConfirmed**
* **confirmed**
* **toBeFixed**
* **fixed**
* **ignored**', example='Confirmed'),
}

model DescribeApisecAbnormalsResponseBody = {
  data?: [ 
    {
      abnormalEventNumber?: long(name='AbnormalEventNumber', description='The number of risk-related security events.', example='2'),
      abnormalId?: string(name='AbnormalId', description='The ID of the risk.', example='7c1431f27ae7e9c8cc64095***68e'),
      abnormalInfo?: string(name='AbnormalInfo', description='The details of the risk. The value is a string that consists of multiple parameters in the JSON format. Valid values:

* **rule**: risk-related rule
* **data_type**: sensitive data type
* **custom_rule_name**: custom rule name
* **rule_name**: built-in rule name', example='{ "data_type": ["1005","1004"], "rule": { "parent": "RiskType_Permission", "code": "Risk_UnauthSensitive", "level": "high", "origin": "default", "name": "Risk_UnauthSensitive" } }'),
      abnormalLevel?: string(name='AbnormalLevel', description='The level of the risk. Valid values:

* **high**
* **medium**
* **low**', example='high'),
      abnormalTag?: string(name='AbnormalTag', description='The type of the risk.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of risks.', example='LackOfSpeedLimit'),
      abnromalStatus?: string(name='AbnromalStatus', description='The status of the risk.', example='unresolved'),
      apiFormat?: string(name='ApiFormat', description='The risk-related API.', example='/api/login'),
      apiId?: string(name='ApiId', description='The ID of the risk-related API.', example='09559c0d71ca2ffc996b81***836d8'),
      apiTag?: string(name='ApiTag', description='The business purpose of the API.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the business purposes of APIs.', example='SendMail'),
      discoverTime?: long(name='DiscoverTime', description='The time at which the risk was first detected. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1684252800'),
      examples?: [ string ](name='Examples', description='The risk-related samples.'),
      firstTime?: long(name='FirstTime', description='The time at which the API was first detected. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1701138088'),
      follow?: long(name='Follow', description='Indicates whether the API is followed. Valid values:

*   **1**: yes
*   **0**(default): no', example='0'),
      ignoreTime?: long(name='IgnoreTime', description='The time at which the risk was marked as ignored. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1684252800'),
      lastestTime?: long(name='LastestTime', description='The time at which the API was last accessed. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1684252800'),
      latestDiscoverTime?: long(name='LatestDiscoverTime', description='The time at which the risk was last detected. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1684252800'),
      matchedHost?: string(name='MatchedHost', description='The domain name or IP address of the API.', example='a.aliyun.com'),
      note?: string(name='Note', description='The remarks.', example='Business side notified'),
      origin?: string(name='Origin', description='The source of the risk type. Valid values:

*   **custom**
*   **default**', example='custom'),
      userStatus?: string(name='UserStatus', description='The status of the risk. Valid values:

* **toBeConfirmed**
* **confirmed**
* **toBeFixed**
* **fixed**
* **ignored**', example='Confirmed'),
    }
  ](name='Data', description='The risks.'),
  requestId?: string(name='RequestId', description='The request ID.', example='9469646C-F2CC-5F0F-8401-C53***4F46'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='35'),
}

model DescribeApisecAbnormalsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecAbnormalsResponseBody(name='body'),
}

/**
 * @summary Queries the list of API security risks.
 *
 * @param request DescribeApisecAbnormalsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecAbnormalsResponse
 */
async function describeApisecAbnormalsWithOptions(request: DescribeApisecAbnormalsRequest, runtime: $RuntimeOptions): DescribeApisecAbnormalsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.abnormalId)) {
    query['AbnormalId'] = request.abnormalId;
  }
  if (!$isNull(request.abnormalLevel)) {
    query['AbnormalLevel'] = request.abnormalLevel;
  }
  if (!$isNull(request.abnormalTag)) {
    query['AbnormalTag'] = request.abnormalTag;
  }
  if (!$isNull(request.apiFormat)) {
    query['ApiFormat'] = request.apiFormat;
  }
  if (!$isNull(request.apiId)) {
    query['ApiId'] = request.apiId;
  }
  if (!$isNull(request.apiTag)) {
    query['ApiTag'] = request.apiTag;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.matchedHost)) {
    query['MatchedHost'] = request.matchedHost;
  }
  if (!$isNull(request.orderKey)) {
    query['OrderKey'] = request.orderKey;
  }
  if (!$isNull(request.orderWay)) {
    query['OrderWay'] = request.orderWay;
  }
  if (!$isNull(request.origin)) {
    query['Origin'] = request.origin;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!$isNull(request.userStatus)) {
    query['UserStatus'] = request.userStatus;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecAbnormals',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the list of API security risks.
 *
 * @param request DescribeApisecAbnormalsRequest
 * @return DescribeApisecAbnormalsResponse
 */
async function describeApisecAbnormals(request: DescribeApisecAbnormalsRequest): DescribeApisecAbnormalsResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecAbnormalsWithOptions(request, runtime);
}

model DescribeApisecApiResourcesRequest {
  apiFormat?: string(name='ApiFormat', description='The API.', example='/auth/login'),
  apiId?: string(name='ApiId', description='The ID of the API.', example='867ade***24ee6e205b8da82b8f84'),
  apiMethod?: string(name='ApiMethod', description='The request method of the API. Valid values:

* **GET**
* **POST**
* **HEAD**
* **PUT**
* **DELETE**
* **CONNECT**
* **PATCH**
* **OPTIONS**', example='POST'),
  apiStatus?: string(name='ApiStatus', description='The API status. Valid values:

* **NewbornInterface**: The API is newly added.
* **OfflineInterface**: The API is inactive.
* **normal**: The API is normal.', example='OfflineInterface'),
  apiTag?: string(name='ApiTag', description='The business purpose of the API.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the business purposes of APIs.', example='SendMail'),
  apiType?: string(name='ApiType', description='The service object. Valid values:

* **PublicAPI**: public services
* **ThirdpartAPI**: cooperation with third-party partners
* **InternalAPI**: internal office', example='innerAPI'),
  authFlag?: string(name='AuthFlag', description='Specifies whether authentication is required. Valid values:

* **0**: Authentication is required.
* **1**: Authentication is not required.', example='0'),
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.

>  This parameter is available only in hybrid cloud scenarios. You can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query hybrid cloud clusters.', example='740'),
  endTime?: string(name='EndTime', description='The end of the time range to query. This value is a UNIX timestamp in UTC. Unit: seconds.', example='1683388800'),
  follow?: long(name='Follow', description='Specifies whether to follow the API. Valid values:

* **1**: follows the API.
* **0**: does not follow the API.', example='0'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-u***gr20j'),
  matchedHost?: string(name='MatchedHost', description='The domain name or IP address of the API.', example='a.aliyun.com'),
  note?: string(name='Note', description='The remarks.', example='API for logon'),
  orderKey?: string(name='OrderKey', description='The name of the sorting field. Valid values:

* **allCnt**: the total number of calls to the API in the previous 30 days
* **botCnt**: the number of bot-initiated requests in the previous 30 days
* **crossBorderCnt**: the number of cross-border requests in the previous 30 days
* **abnormalNum**: the number of API-related risks
* **eventNum**: the number of API-related security events
* **farthestTs**: the time when the API was first detected
* **lastestTs**: the time of the most recent access to the API', example='allCnt'),
  orderWay?: string(name='OrderWay', description='The sorting method. Valid values:

* **desc** (default): descending order
* **asc**: ascending order', example='desc'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Value:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  requestSensitiveType?: string(name='RequestSensitiveType', description='The sensitive data type in the request.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported sensitive data types.', example='1004,1005'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  sensitiveLevel?: string(name='SensitiveLevel', description='The sensitivity level of the API. Valid values:

* **L1**: high sensitivity
* **L2**: moderate sensitivity
* **L3**: low sensitivity
* **N**: non-sensitivity', example='L3'),
  sensitiveType?: string(name='SensitiveType', description='The sensitive data type in the response.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported sensitive data types.', example='1004'),
  startTime?: string(name='StartTime', description='The beginning of the time range to query. This value is a UNIX timestamp in UTC. Unit: seconds.', example='1681833600'),
}

model DescribeApisecApiResourcesResponseBody = {
  data?: [ 
    {
      abnormalNum?: long(name='AbnormalNum', description='The number of API-related risks.', example='2'),
      allCnt?: long(name='AllCnt', description='The total number of calls to this API in the previous 30 days.', example='10'),
      apiFormat?: string(name='ApiFormat', description='The API.', example='/v1/etl/finddatabyvid'),
      apiId?: string(name='ApiId', description='The ID of the API.', example='867ade***24ee6e205b8da82b8f84'),
      apiInfo?: string(name='ApiInfo', description='The API-related information. The value of this parameter is a JSON string that contains multiple parameters. The value includes the following parameters:

* **param_num**: the number of API parameters
* **request_method**: the request method
* **protocol**: the request protocol
* **api_url**: the request URL
* **poc_payload**: the request
* **request**: the sample request
* **response**: the sample response
* **param**: the request parameters'),
      apiMethod?: string(name='ApiMethod', description='The request method of the API. Valid values:

* **GET**
* **POST**
* **HEAD**
* **PUT**
* **DELETE**
* **CONNECT**
* **PATCH**
* **OPTIONS**', example='POST'),
      apiSensitive?: string(name='ApiSensitive', description='The API-related sensitive information. The value of this parameter is a JSON string that contains multiple parameters. The value includes the following parameters:

* **request_sensitive_list**: the sensitive data type in the request
* **response_sensitive_list**: the sensitive data type in the response
* **sensitive_list**: sensitive data types
* **sensitive_level**: sensitivity level', example='{
    "sensitive_list": ["1003","1005"],
    "sensitive_level": "L2",
    "request_sensitive_list": ["1003"],
    "response_sensitive_list": ["1005"]
}'),
      apiSensitiveRequest?: string(name='ApiSensitiveRequest', description='The sensitive data type in the request.', example='["1002","1005"]'),
      apiSensitiveResponse?: string(name='ApiSensitiveResponse', description='The sensitive data type in the response.', example='["1002","1005"]'),
      apiStatus?: string(name='ApiStatus', description='The API status. Valid values:

*   **NewbornInterface**: The API is newly added.
*   **OfflineInterface**: The API is inactive.
*   **normal**: The API is normal.', example='NewbornInterface'),
      apiTag?: string(name='ApiTag', description='The business purpose of the API.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the business purposes of APIs.', example='SendMail'),
      apiType?: string(name='ApiType', description='The service object. Valid values:

*   **PublicAPI**: public services
*   **ThirdpartAPI**: cooperation with third-party partners
*   **InternalAPI**: internal office', example='PublicAPI'),
      authFlag?: string(name='AuthFlag', description='Indicates whether authentication is required. Valid values:

* **0**: Authentication is required.
* **1**: Authentication is not required.', example='1'),
      botCnt?: long(name='BotCnt', description='The number of bot-initiated requests in the previous 30 days.', example='2'),
      crossBorderCnt?: long(name='CrossBorderCnt', description='The number of the cross-border requests in the previous 30 days.', example='2'),
      eventNum?: long(name='EventNum', description='The number of API-related security events.', example='2'),
      examples?: [ string ](name='Examples', description='The sample APIs.'),
      farthestTs?: long(name='FarthestTs', description='The time when the API asset was first detected. This value is a UNIX timestamp in UTC. Unit: seconds.', example='1683388800'),
      follow?: int32(name='Follow', description='Specifies whether to follow the API. Valid values:

*   **1**: follows the API.
*   **0**: does not follow the API.', example='1'),
      lastestTs?: long(name='LastestTs', description='The time at which the API was last accessed. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1683388800'),
      matchedHost?: string(name='MatchedHost', description='The domain name or IP address of the API.', example='a.aliyun.com'),
      note?: string(name='Note', description='The remarks.', example='Password changed'),
      resources?: [ string ](name='Resources', description='The list of protection objects corresponding to this asset.'),
    }
  ](name='Data', description='The API assets.'),
  requestId?: string(name='RequestId', description='The request ID.', example='2EFCFE18-78F8-5079-B312-07***48B'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='5'),
}

model DescribeApisecApiResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecApiResourcesResponseBody(name='body'),
}

/**
 * @summary Queries API assets in the API security module.
 *
 * @param request DescribeApisecApiResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecApiResourcesResponse
 */
async function describeApisecApiResourcesWithOptions(request: DescribeApisecApiResourcesRequest, runtime: $RuntimeOptions): DescribeApisecApiResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.apiFormat)) {
    query['ApiFormat'] = request.apiFormat;
  }
  if (!$isNull(request.apiId)) {
    query['ApiId'] = request.apiId;
  }
  if (!$isNull(request.apiMethod)) {
    query['ApiMethod'] = request.apiMethod;
  }
  if (!$isNull(request.apiStatus)) {
    query['ApiStatus'] = request.apiStatus;
  }
  if (!$isNull(request.apiTag)) {
    query['ApiTag'] = request.apiTag;
  }
  if (!$isNull(request.apiType)) {
    query['ApiType'] = request.apiType;
  }
  if (!$isNull(request.authFlag)) {
    query['AuthFlag'] = request.authFlag;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.follow)) {
    query['Follow'] = request.follow;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.matchedHost)) {
    query['MatchedHost'] = request.matchedHost;
  }
  if (!$isNull(request.note)) {
    query['Note'] = request.note;
  }
  if (!$isNull(request.orderKey)) {
    query['OrderKey'] = request.orderKey;
  }
  if (!$isNull(request.orderWay)) {
    query['OrderWay'] = request.orderWay;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.requestSensitiveType)) {
    query['RequestSensitiveType'] = request.requestSensitiveType;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.sensitiveLevel)) {
    query['SensitiveLevel'] = request.sensitiveLevel;
  }
  if (!$isNull(request.sensitiveType)) {
    query['SensitiveType'] = request.sensitiveType;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecApiResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries API assets in the API security module.
 *
 * @param request DescribeApisecApiResourcesRequest
 * @return DescribeApisecApiResourcesResponse
 */
async function describeApisecApiResources(request: DescribeApisecApiResourcesRequest): DescribeApisecApiResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecApiResourcesWithOptions(request, runtime);
}

model DescribeApisecAssetTrendRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.', example='590'),
  endTime?: long(name='EndTime', description='The end of the time range to query. Specify a UNIX timestamp in UTC. Unit: seconds.', example='1683183599'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-ww**b06'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aek**7uq'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. Specify a UNIX timestamp in UTC. Unit: seconds.', example='1668496310'),
}

model DescribeApisecAssetTrendResponseBody = {
  data?: [ 
    {
      assetActive?: long(name='AssetActive', description='The number of active assets.', example='60'),
      assetCount?: long(name='AssetCount', description='The total number of assets.', example='80'),
      assetOffline?: long(name='AssetOffline', description='The number of deactivated assets.', example='20'),
      timestamp?: long(name='Timestamp', description='The time for statistics. Specify a UNIX timestamp in UTC. Unit: seconds.', example='1683600042'),
    }
  ](name='Data', description='The data returned.'),
  requestId?: string(name='RequestId', description='Id of the request.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model DescribeApisecAssetTrendResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecAssetTrendResponseBody(name='body'),
}

/**
 * @summary Queries the asset trends in the API security module.
 *
 * @param request DescribeApisecAssetTrendRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecAssetTrendResponse
 */
async function describeApisecAssetTrendWithOptions(request: DescribeApisecAssetTrendRequest, runtime: $RuntimeOptions): DescribeApisecAssetTrendResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecAssetTrend',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the asset trends in the API security module.
 *
 * @param request DescribeApisecAssetTrendRequest
 * @return DescribeApisecAssetTrendResponse
 */
async function describeApisecAssetTrend(request: DescribeApisecAssetTrendRequest): DescribeApisecAssetTrendResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecAssetTrendWithOptions(request, runtime);
}

model DescribeApisecEventDomainStatisticRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  endTime?: long(name='EndTime', description='The end of the time range to query. Specify a UNIX timestamp in UTC. Unit: seconds.', example='1686895256'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  orderWay?: string(name='OrderWay', description='The sorting order. Valid values:

- **asc**: ascending order.
- **desc**: descending order.', example='desc'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **5**.', example='5'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfmvyknl****fa'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. Specify a UNIX timestamp in UTC. Unit: seconds.', example='1668496310'),
}

model DescribeApisecEventDomainStatisticResponseBody = {
  data?: [ 
    {
      apiCount?: long(name='ApiCount', description='The number of APIs.', example='10'),
      domain?: string(name='Domain', description='The domain name.', example='a.aliyun.com'),
      high?: long(name='High', description='The number of high-risk security events.', example='10'),
      low?: long(name='Low', description='The number of low-risk security events.', example='2'),
      medium?: long(name='Medium', description='The number of medium-risk security events.', example='6'),
    }
  ](name='Data', description='The response parameters.'),
  requestId?: string(name='RequestId', description='Id of the request.', example='66A98669-*******-80A6-3014697B11AE'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model DescribeApisecEventDomainStatisticResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecEventDomainStatisticResponseBody(name='body'),
}

/**
 * @summary Queries the statistics on domain names on which security events are detected by the API security module.
 *
 * @param request DescribeApisecEventDomainStatisticRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecEventDomainStatisticResponse
 */
async function describeApisecEventDomainStatisticWithOptions(request: DescribeApisecEventDomainStatisticRequest, runtime: $RuntimeOptions): DescribeApisecEventDomainStatisticResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.orderWay)) {
    query['OrderWay'] = request.orderWay;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecEventDomainStatistic',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the statistics on domain names on which security events are detected by the API security module.
 *
 * @param request DescribeApisecEventDomainStatisticRequest
 * @return DescribeApisecEventDomainStatisticResponse
 */
async function describeApisecEventDomainStatistic(request: DescribeApisecEventDomainStatisticRequest): DescribeApisecEventDomainStatisticResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecEventDomainStatisticWithOptions(request, runtime);
}

model DescribeApisecEventsRequest {
  apiFormat?: string(name='ApiFormat', description='The API.', example='/apisec/v1/register.php'),
  apiId?: string(name='ApiId', description='The ID of the event-related API.', example='820b860***6205da93b935b28'),
  apiTag?: string(name='ApiTag', description='The business purpose of the API.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the business purposes of APIs.', example='SendMail'),
  attackIp?: string(name='AttackIp', description='The Attack source IP.', example='42.224.*.*'),
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.

>  This parameter is available only in hybrid cloud scenarios. You can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query hybrid cloud clusters.', example='428'),
  endTs?: long(name='EndTs', description='The end of the time range to query. This value is a UNIX timestamp in UTC. Unit: seconds.', example='1683703260'),
  eventId?: string(name='EventId', description='The ID of the API security event.', example='18ba94fea9***e66ba0557b7b91'),
  eventLevel?: string(name='EventLevel', description='The severity level of the event. Valid values:

*   **high**
*   **medium**
*   **low**', example='low'),
  eventTag?: string(name='EventTag', description='The type of the event.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported event types.', example='ObtainSensitiveUnauthorized'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-5y***d31'),
  matchedHost?: string(name='MatchedHost', description='The domain name or IP address of the API.', example='a.aliyun.com'),
  orderKey?: string(name='OrderKey', description='The name of the sorting field. Valid values:

*   **allCnt**: the number of attacks
*   **startTs**: the start time of the event
*   **endTs**: the end time of the event', example='startTs'),
  orderWay?: string(name='OrderWay', description='The sorting method. Valid values:

*   **desc** (default): descending order
*   **asc**: ascending order', example='desc'),
  origin?: string(name='Origin', description='The source of the event type. Valid values:

*   **custom**
*   **default**', example='default'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Value:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTs?: long(name='StartTs', description='The beginning of the time range to query. This value is a UNIX timestamp in UTC. Unit: seconds.', example='1683648000'),
  userStatus?: string(name='UserStatus', description='The event status. Valid values:

*   **toBeConfirmed**
*   **confirmed**
*   **ignored**', example='Ignore'),
}

model DescribeApisecEventsResponseBody = {
  data?: [ 
    {
      allCnt?: long(name='AllCnt', description='The number of attacks.
>Notice: The parameter has been deprecated, please use the Attackips parameter.', example='10'),
      apiFormat?: string(name='ApiFormat', description='The API.', example='/apisec/v1/register.php'),
      apiId?: string(name='ApiId', description='The ID of the API that is associated with the security event.', example='2ecc1cf67b91853bc55545052ccf06a8'),
      apiTag?: string(name='ApiTag', description='The business purpose of the API.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the business purposes of APIs.', example='SendMail'),
      attackClient?: string(name='AttackClient', description='The client that is attacked.', example='Chrome'),
      attackCntInfo?: string(name='AttackCntInfo', description='The information about the number of attacks. The value of this parameter is a JSON string that contains multiple parameters. Key indicates the timestamp in seconds, and Value indicates the number of attacks.', example='{\\\\"1717498320\\\\":500,\\\\"1717498380\\\\":529,\\\\"1717498440\\\\":20,\\\\"1717498260\\\\":518,\\\\"1717498200\\\\":481,\\\\"1717498140\\\\":52}'),
      attackIp?: string(name='AttackIp', description='The source IP address of the attack.', example='104.234.140.33'),
      attackIpInfo?: string(name='AttackIpInfo', description='The information about the attack source IP address. The value of this parameter is a JSON string that contains multiple parameters. The value includes the following parameters:

*   **ip**: the IP address
*   **country_id**: the country ID
*   **region_id**: the region ID
*   **cnt**: the number of attacks', example='[{\\\\"ip\\\\":\\\\"72.*.*.119\\\\",\\\\"country_id\\\\":\\\\"US\\\\",\\\\"region_id\\\\":\\\\"\\\\",\\\\"cnt\\\\":\\\\"2100\\\\"}]'),
      attackIps?: [ string ](name='AttackIps', description='The source IP addresses of the attacks.'),
      endTs?: long(name='EndTs', description='The end of the time range to query. This value is a UNIX timestamp in UTC. Unit: seconds.', example='1683703260'),
      eventId?: string(name='EventId', description='The ID of the event.', example='c82cb276847e9c96f9597d9f4b0cdcff'),
      eventInfo?: string(name='EventInfo', description='The details of the event. The value of this parameter is a JSON string that contains multiple parameters. The value includes the following parameters:

*   **ip_info**: the information about the attack source IP address. This parameter corresponds to the **AttackIpInfo** response parameter.
*   **rule_id**: the ID of the rule corresponding to the event.
*   **rule_tag**: the information about the rule corresponding to the event.', example='{}'),
      eventLevel?: string(name='EventLevel', description='The severity level of the event. Valid values:

*   **high**
*   **medium**
*   **low**', example='medium'),
      eventTag?: string(name='EventTag', description='The type of the event.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported event types.', example='ObtainSensitiveUnauthorized'),
      follow?: int32(name='Follow', description='Indicates whether the API is followed. Valid values:

*   **1**: The API is followed.
*   **0**: The API is not followed.', example='0'),
      matchedHost?: string(name='MatchedHost', description='The domain name or IP address of the API.', example='a.aliyun.com'),
      note?: string(name='Note', description='The remarks.', example='Notified'),
      origin?: string(name='Origin', description='The source of the event type. Valid values:

*   **custom**
*   **default**', example='custom'),
      remoteCountry?: string(name='RemoteCountry', description='The country to which the attack source IP address belongs.', example='US'),
      remoteRegion?: string(name='RemoteRegion', description='The region to which the attack source IP address belongs.', example='110000'),
      requestData?: string(name='RequestData', description='The sample API request. The value of this parameter is a JSON string that contains multiple parameters.', example='{}'),
      responseData?: string(name='ResponseData', description='The sample API response. The value of this parameter is a JSON string that contains multiple parameters.', example='{}'),
      startTs?: long(name='StartTs', description='The beginning of the time range to query. This value is a UNIX timestamp in UTC. Unit: seconds.', example='1683648000'),
      userStatus?: string(name='UserStatus', description='The event status. Valid values:

*   **toBeConfirmed**
*   **confirmed**
*   **ignored**', example='Ignore'),
    }
  ](name='Data', description='The security events.'),
  requestId?: string(name='RequestId', description='The request ID.', example='12F4CC8F-7E9F-5E4D-BF7C-BD1EDDE0C282'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='3'),
}

model DescribeApisecEventsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecEventsResponseBody(name='body'),
}

/**
 * @summary Queries API security events.
 *
 * @param request DescribeApisecEventsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecEventsResponse
 */
async function describeApisecEventsWithOptions(request: DescribeApisecEventsRequest, runtime: $RuntimeOptions): DescribeApisecEventsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.apiFormat)) {
    query['ApiFormat'] = request.apiFormat;
  }
  if (!$isNull(request.apiId)) {
    query['ApiId'] = request.apiId;
  }
  if (!$isNull(request.apiTag)) {
    query['ApiTag'] = request.apiTag;
  }
  if (!$isNull(request.attackIp)) {
    query['AttackIp'] = request.attackIp;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTs)) {
    query['EndTs'] = request.endTs;
  }
  if (!$isNull(request.eventId)) {
    query['EventId'] = request.eventId;
  }
  if (!$isNull(request.eventLevel)) {
    query['EventLevel'] = request.eventLevel;
  }
  if (!$isNull(request.eventTag)) {
    query['EventTag'] = request.eventTag;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.matchedHost)) {
    query['MatchedHost'] = request.matchedHost;
  }
  if (!$isNull(request.orderKey)) {
    query['OrderKey'] = request.orderKey;
  }
  if (!$isNull(request.orderWay)) {
    query['OrderWay'] = request.orderWay;
  }
  if (!$isNull(request.origin)) {
    query['Origin'] = request.origin;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTs)) {
    query['StartTs'] = request.startTs;
  }
  if (!$isNull(request.userStatus)) {
    query['UserStatus'] = request.userStatus;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecEvents',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries API security events.
 *
 * @param request DescribeApisecEventsRequest
 * @return DescribeApisecEventsResponse
 */
async function describeApisecEvents(request: DescribeApisecEventsRequest): DescribeApisecEventsResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecEventsWithOptions(request, runtime);
}

model DescribeApisecLogDeliveriesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3_public_cn-uqm2z****0a'),
  regionId?: string(name='RegionId', description='The region where the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeApisecLogDeliveriesResponseBody = {
  deliveryConfigs?: [ 
    {
      assertKey?: string(name='AssertKey', description='The type of the log subscription. Valid values:

*   **risk**: risk information.
*   **event**: attack event information.
*   **asset**: asset information.', example='risk'),
      logRegionId?: string(name='LogRegionId', description='The ID of the region where logs are stored.', example='cn-hangzhou'),
      logStoreName?: string(name='LogStoreName', description='The name of the Logstore in Simple Log Service.', example='apisec-logstore***'),
      projectName?: string(name='ProjectName', description='The name of the project in Simple Log Service.', example='apisec-project-14316572********'),
      status?: boolean(name='Status', description='The status of API security log subscription. Valid values:

*   **true**: enabled.
*   **false**: disabled.', example='true'),
    }
  ](name='DeliveryConfigs', description='The configurations of API security log subscription.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='2EFCFE18-78F8-5079-B312-07***48B'),
}

model DescribeApisecLogDeliveriesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecLogDeliveriesResponseBody(name='body'),
}

/**
 * @summary Queries the configurations of API security log subscription.
 *
 * @param request DescribeApisecLogDeliveriesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecLogDeliveriesResponse
 */
async function describeApisecLogDeliveriesWithOptions(request: DescribeApisecLogDeliveriesRequest, runtime: $RuntimeOptions): DescribeApisecLogDeliveriesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecLogDeliveries',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the configurations of API security log subscription.
 *
 * @param request DescribeApisecLogDeliveriesRequest
 * @return DescribeApisecLogDeliveriesResponse
 */
async function describeApisecLogDeliveries(request: DescribeApisecLogDeliveriesRequest): DescribeApisecLogDeliveriesResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecLogDeliveriesWithOptions(request, runtime);
}

model DescribeApisecMatchedHostsRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='433'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-x0r37plpl0g'),
  matchedHost?: string(name='MatchedHost', description='The domain name or IP address.', example='bc.aliyun.com'),
  pageNumber?: string(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: string(name='PageSize', description='The number of entries per page. Default value: **10**.', example='8'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekz5qqo7jthcsa'),
  type?: string(name='Type', description='The detection type. Valid values:

*   **api**: API-related domain names
*   **abnormal**: risk-related domain names
*   **event**: security event-related domain names', example='event'),
}

model DescribeApisecMatchedHostsResponseBody = {
  data?: [ 
    {
      count?: long(name='Count', description='The number of APIs related to the domain name.', example='31'),
      matchedHost?: string(name='MatchedHost', description='The domain name or IP address.', example='bc.aliyun.com'),
    }
  ](name='Data', description='The domain names.'),
  requestId?: string(name='RequestId', description='The request ID.', example='8D4CA088-F72B-5658-BD5B-ECE8B8F0C7BB'),
  totalCount?: string(name='TotalCount', description='The total number of entries returned.', example='2'),
}

model DescribeApisecMatchedHostsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecMatchedHostsResponseBody(name='body'),
}

/**
 * @summary Queries the list of domain names detected in the API security module.
 *
 * @param request DescribeApisecMatchedHostsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecMatchedHostsResponse
 */
async function describeApisecMatchedHostsWithOptions(request: DescribeApisecMatchedHostsRequest, runtime: $RuntimeOptions): DescribeApisecMatchedHostsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.matchedHost)) {
    query['MatchedHost'] = request.matchedHost;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecMatchedHosts',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the list of domain names detected in the API security module.
 *
 * @param request DescribeApisecMatchedHostsRequest
 * @return DescribeApisecMatchedHostsResponse
 */
async function describeApisecMatchedHosts(request: DescribeApisecMatchedHostsRequest): DescribeApisecMatchedHostsResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecMatchedHostsWithOptions(request, runtime);
}

model DescribeApisecProtectionGroupsRequest {
  apisecStatus?: int32(name='ApisecStatus', description='The switch of the API security module.', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceGroup?: string(name='ResourceGroup', description='The name of the protected object group to which the protected object belongs.', example='group1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeApisecProtectionGroupsResponseBody = {
  data?: [ 
    {
      apisecStatus?: long(name='ApisecStatus', description='The switch of the API security module.', example='1'),
      reportStatus?: long(name='ReportStatus', description='The switch of the compliance check feature.', example='0'),
      resourceGroup?: string(name='ResourceGroup', description='The name of the protected object group.', example='group1'),
      traceStatus?: long(name='TraceStatus', description='The switch of the tracing and auditing feature.', example='0'),
    }
  ](name='Data', description='The protected object groups.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
  totalCount?: long(name='TotalCount', description='The total number of protected object groups.', example='8'),
}

model DescribeApisecProtectionGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecProtectionGroupsResponseBody(name='body'),
}

/**
 * @summary Queries the list of protected object groups to which API security policies are applied.
 *
 * @param request DescribeApisecProtectionGroupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecProtectionGroupsResponse
 */
async function describeApisecProtectionGroupsWithOptions(request: DescribeApisecProtectionGroupsRequest, runtime: $RuntimeOptions): DescribeApisecProtectionGroupsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.apisecStatus)) {
    query['ApisecStatus'] = request.apisecStatus;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceGroup)) {
    query['ResourceGroup'] = request.resourceGroup;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecProtectionGroups',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the list of protected object groups to which API security policies are applied.
 *
 * @param request DescribeApisecProtectionGroupsRequest
 * @return DescribeApisecProtectionGroupsResponse
 */
async function describeApisecProtectionGroups(request: DescribeApisecProtectionGroupsRequest): DescribeApisecProtectionGroupsResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecProtectionGroupsWithOptions(request, runtime);
}

model DescribeApisecProtectionResourcesRequest {
  apisecStatus?: int32(name='ApisecStatus', description='The switch of the API security module.', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-0xldbqt****'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The name of the protected object.', example='cwaf-***-waf'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeApisecProtectionResourcesResponseBody = {
  data?: [ 
    {
      apisecStatus?: long(name='ApisecStatus', description='The switch of the API security module.', example='1'),
      reportStatus?: long(name='ReportStatus', description='The switch of the compliance check feature.', example='1'),
      resource?: string(name='Resource', description='The protected object.', example='cwaf-***-waf'),
      traceStatus?: long(name='TraceStatus', description='The switch of the tracing and auditing feature.', example='0'),
    }
  ](name='Data', description='The protected objects.'),
  requestId?: string(name='RequestId', description='The request ID.', example='2EFCFE18-78F8-5079-B312-07***48B'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='5'),
}

model DescribeApisecProtectionResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecProtectionResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the list of protected objects to which API security policies are applied.
 *
 * @param request DescribeApisecProtectionResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecProtectionResourcesResponse
 */
async function describeApisecProtectionResourcesWithOptions(request: DescribeApisecProtectionResourcesRequest, runtime: $RuntimeOptions): DescribeApisecProtectionResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.apisecStatus)) {
    query['ApisecStatus'] = request.apisecStatus;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecProtectionResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the list of protected objects to which API security policies are applied.
 *
 * @param request DescribeApisecProtectionResourcesRequest
 * @return DescribeApisecProtectionResourcesResponse
 */
async function describeApisecProtectionResources(request: DescribeApisecProtectionResourcesRequest): DescribeApisecProtectionResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecProtectionResourcesWithOptions(request, runtime);
}

model DescribeApisecRulesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_elasticity-cn-0x***'),
  level?: string(name='Level', description='The level of the policy.

If Type is set to risk or event, you can set this parameter to one of the following values:

*   **high**
*   **medium**
*   **low**

If Type is set to sensitive_word, you can set this parameter to one of the following values:

*   **S1**
*   **S2**
*   **S3**
*   **S4**', example='high'),
  name?: string(name='Name', description='The name of the policy.', example='Information Leak'),
  origin?: string(name='Origin', description='The source of the policy. Valid values:

*   **custom**
*   **default**', example='custom'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  status?: long(name='Status', description='The status of the policy. Valid values:

*   **1**: enabled
*   **0**: disabled', example='1'),
  type?: string(name='Type', description='The type of the policy. Valid values:

*   **risk**: risk detection
*   **event**: security event
*   **sensitive_word**: sensitive data
*   **auth_flag**: authentication credential
*   **api_tag**: business purpose
*   **desensitization**: masking
*   **whitelist**: whitelist
*   **recognition**: API recognition
*   **offline_api**: lifecycle management

This parameter is required.', example='risk'),
}

model DescribeApisecRulesResponseBody = {
  data?: [ 
    {
      id?: long(name='Id', description='The ID of the policy.', example='34933'),
      rule?: string(name='Rule', description='The details of the policy. The value is a string that consists of multiple parameters in the JSON format.', example='{
    "ext": "Date",
    "regex": "-",
    "code": "2009",
    "level": "S1",
    "origin": "default",
    "name": "2009"
}'),
      status?: long(name='Status', description='The status of the policy. Valid values:

*   **1**: enabled
*   **0**: disabled', example='1'),
      type?: string(name='Type', description='The type of the policy. Valid values:

*   **risk**: risk detection
*   **event**: security event
*   **sensitive_word**: sensitive data
*   **auth_flag**: authentication credential
*   **api_tag**: business purpose
*   **desensitization**: data masking
*   **whitelist**: whitelist
*   **recognition**: API recognition
*   **offline_api**: lifecycle management', example='risk'),
      updateTime?: long(name='UpdateTime', description='The time when the policy was updated. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1721095301'),
    }
  ](name='Data', description='The policies.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='6'),
}

model DescribeApisecRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecRulesResponseBody(name='body'),
}

/**
 * @summary Queries the policies configured in the API security module.
 *
 * @param request DescribeApisecRulesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecRulesResponse
 */
async function describeApisecRulesWithOptions(request: DescribeApisecRulesRequest, runtime: $RuntimeOptions): DescribeApisecRulesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.level)) {
    query['Level'] = request.level;
  }
  if (!$isNull(request.name)) {
    query['Name'] = request.name;
  }
  if (!$isNull(request.origin)) {
    query['Origin'] = request.origin;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.status)) {
    query['Status'] = request.status;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecRules',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the policies configured in the API security module.
 *
 * @param request DescribeApisecRulesRequest
 * @return DescribeApisecRulesResponse
 */
async function describeApisecRules(request: DescribeApisecRulesRequest): DescribeApisecRulesResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecRulesWithOptions(request, runtime);
}

model DescribeApisecSensitiveDomainStatisticRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.', example='428'),
  endTime?: long(name='EndTime', description='The end of the time range to query. Specify a UNIX timestamp in UTC. Unit: milliseconds.', example='1686895256'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  orderWay?: string(name='OrderWay', description='The sorting order. Valid values:

-  **asc**: ascending order.
- **desc**: descending order.', example='desc'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **5**.', example='5'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. Specify a UNIX timestamp in UTC. Unit: milliseconds.', example='1668496310'),
  type?: string(name='Type', description='The sensitive data type. Valid values:

- **request**: sensitive data in requests.
- **response**: sensitive data in responses.', example='request'),
}

model DescribeApisecSensitiveDomainStatisticResponseBody = {
  data?: [ 
    {
      apiCount?: long(name='ApiCount', description='The number of APIs that are involved.', example='10'),
      domainCount?: long(name='DomainCount', description='The number of sites that are involved.', example='10'),
      sensitiveCode?: string(name='SensitiveCode', description='The code of the sensitive data.
>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported sensitive data types.', example='10'),
      sensitiveLevel?: string(name='SensitiveLevel', description='The sensitivity level of the sensitive data.Valid values:

* **S1**: low sensitivity.
* **S2**: moderate sensitivity.
* **S3**: high sensitivity.', example='L3'),
      sensitiveName?: string(name='SensitiveName', description='The name of the sensitive data.', example='1002'),
    }
  ](name='Data', description='The response parameters.'),
  requestId?: string(name='RequestId', description='The request ID.', example='56B40D30-4960-4F19-B7D5-2B1F***6CB70'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='27'),
}

model DescribeApisecSensitiveDomainStatisticResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecSensitiveDomainStatisticResponseBody(name='body'),
}

/**
 * @summary Queries the statistics on domain names on which sensitive data is detected by the API security module.
 *
 * @param request DescribeApisecSensitiveDomainStatisticRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecSensitiveDomainStatisticResponse
 */
async function describeApisecSensitiveDomainStatisticWithOptions(request: DescribeApisecSensitiveDomainStatisticRequest, runtime: $RuntimeOptions): DescribeApisecSensitiveDomainStatisticResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.orderWay)) {
    query['OrderWay'] = request.orderWay;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecSensitiveDomainStatistic',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the statistics on domain names on which sensitive data is detected by the API security module.
 *
 * @param request DescribeApisecSensitiveDomainStatisticRequest
 * @return DescribeApisecSensitiveDomainStatisticResponse
 */
async function describeApisecSensitiveDomainStatistic(request: DescribeApisecSensitiveDomainStatisticRequest): DescribeApisecSensitiveDomainStatisticResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecSensitiveDomainStatisticWithOptions(request, runtime);
}

model DescribeApisecSlsLogStoresRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3_public_cn-uqm2z****0a'),
  logRegionId?: string(name='LogRegionId', description='The ID of the region where logs are stored.

>  You can call the [DescribeUserSlsLogRegions](https://help.aliyun.com/document_detail/2712598.html) operation to query available log storage regions.

This parameter is required.', example='cn-hangzhou'),
  projectName?: string(name='ProjectName', description='The name of the project in Simple Log Service.

This parameter is required.', example='apisec-project-14316572********'),
  regionId?: string(name='RegionId', description='The region where the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeApisecSlsLogStoresResponseBody = {
  logStores?: [ string ](name='LogStores', description='The names of the Logstores in Simple Log Service.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model DescribeApisecSlsLogStoresResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecSlsLogStoresResponseBody(name='body'),
}

/**
 * @summary Queries the Logstores whose names start with apisec- in Simple Log Service.
 *
 * @param request DescribeApisecSlsLogStoresRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecSlsLogStoresResponse
 */
async function describeApisecSlsLogStoresWithOptions(request: DescribeApisecSlsLogStoresRequest, runtime: $RuntimeOptions): DescribeApisecSlsLogStoresResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.logRegionId)) {
    query['LogRegionId'] = request.logRegionId;
  }
  if (!$isNull(request.projectName)) {
    query['ProjectName'] = request.projectName;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecSlsLogStores',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the Logstores whose names start with apisec- in Simple Log Service.
 *
 * @param request DescribeApisecSlsLogStoresRequest
 * @return DescribeApisecSlsLogStoresResponse
 */
async function describeApisecSlsLogStores(request: DescribeApisecSlsLogStoresRequest): DescribeApisecSlsLogStoresResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecSlsLogStoresWithOptions(request, runtime);
}

model DescribeApisecSlsProjectsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3_public_cn-uqm2z****0a'),
  logRegionId?: string(name='LogRegionId', description='The ID of the region where logs are stored.

>  You can call the [DescribeUserSlsLogRegions](https://help.aliyun.com/document_detail/2712598.html) operation to query available log storage regions.

This parameter is required.', example='cn-hangzhou'),
  regionId?: string(name='RegionId', description='The region where the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeApisecSlsProjectsResponseBody = {
  projects?: [ string ](name='Projects', description='The names of the projects in Simple Log Service.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model DescribeApisecSlsProjectsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecSlsProjectsResponseBody(name='body'),
}

/**
 * @summary Queries the projects whose names start with apisec- in Simple Log Service.
 *
 * @param request DescribeApisecSlsProjectsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecSlsProjectsResponse
 */
async function describeApisecSlsProjectsWithOptions(request: DescribeApisecSlsProjectsRequest, runtime: $RuntimeOptions): DescribeApisecSlsProjectsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.logRegionId)) {
    query['LogRegionId'] = request.logRegionId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecSlsProjects',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the projects whose names start with apisec- in Simple Log Service.
 *
 * @param request DescribeApisecSlsProjectsRequest
 * @return DescribeApisecSlsProjectsResponse
 */
async function describeApisecSlsProjects(request: DescribeApisecSlsProjectsRequest): DescribeApisecSlsProjectsResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecSlsProjectsWithOptions(request, runtime);
}

model DescribeApisecStatisticsRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.

>  This parameter is available only in hybrid cloud scenarios. You can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query hybrid cloud clusters.', example='428'),
  instanceId?: string(name='InstanceId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

* **cn-hangzhou**: Chinese mainland
* **ap-southeast-1**: outside the Chinese mainland

This parameter is required.', example='waf_v2_public_cn-uax***b09'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aek2***uwbs5q'),
  type?: string(name='Type', description='The type of the statistics. Valid values:

*   **risk**: risk-related statistics.
*   **event**: event-related statistics.', example='asset_num'),
}

model DescribeApisecStatisticsResponseBody = {
  data?: {
    actioned?: long(name='Actioned', description='The number of handled events.', example='1'),
    api?: long(name='Api', description='The number of APIs.', example='/api/v1/login'),
    confirmed?: long(name='Confirmed', description='The number of confirmed events.', example='10'),
    domain?: long(name='Domain', description='The number of domain names.', example='a.aliyun.com'),
    fixed?: long(name='Fixed', description='The number of fixed risks.', example='0'),
    high?: long(name='High', description='The number of high-risk events.', example='10'),
    ignore?: long(name='Ignore', description='The number of ignored risks.', example='0'),
    low?: long(name='Low', description='The number of low-risk events.', example='10'),
    medium?: long(name='Medium', description='The number of moderate-risk events.', example='10'),
    toBeConfirmed?: long(name='ToBeConfirmed', description='The number of events to be confirmed.', example='10'),
    toBeFixed?: long(name='ToBeFixed', description='The number of risks to be fixed.', example='10'),
    todayHigh?: string(name='TodayHigh', description='The number of new high-risk events today.', example='10'),
    todayLow?: long(name='TodayLow', description='The number of new low-risk events today.', example='10'),
    todayMedium?: string(name='TodayMedium', description='The number of new moderate-risk events today.', example='10'),
    todayTotal?: string(name='TodayTotal', description='The total number of new events today.', example='30'),
    total?: long(name='Total', description='The total number of events.', example='30'),
  }(name='Data', description='The returned results.'),
  requestId?: string(name='RequestId', description='The request ID.', example='221F0F14-54C6-59A1-9967-72***81B61A'),
}

model DescribeApisecStatisticsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecStatisticsResponseBody(name='body'),
}

/**
 * @summary Queries the statistics of API security-related risks and events.
 *
 * @param request DescribeApisecStatisticsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecStatisticsResponse
 */
async function describeApisecStatisticsWithOptions(request: DescribeApisecStatisticsRequest, runtime: $RuntimeOptions): DescribeApisecStatisticsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecStatistics',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the statistics of API security-related risks and events.
 *
 * @param request DescribeApisecStatisticsRequest
 * @return DescribeApisecStatisticsResponse
 */
async function describeApisecStatistics(request: DescribeApisecStatisticsRequest): DescribeApisecStatisticsResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecStatisticsWithOptions(request, runtime);
}

model DescribeApisecSuggestionsRequest {
  apiId?: string(name='ApiId', description='The ID of the API.

This parameter is required.', example='a60fd7e3021fe371c06dc1dcb883def0'),
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-pe336n43m04'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeApisecSuggestionsResponseBody = {
  data?: [ 
    {
      apiFormat?: string(name='ApiFormat', description='The API.', example='/apisec/v1/saveinfo'),
      matchedHost?: string(name='MatchedHost', description='The domain name or IP address of the API.', example='a.aliyun.com'),
      suggestId?: string(name='SuggestId', description='The rule ID of the protection suggestion.', example='15060a1f8fed40130b7c4a7bf8d8733b'),
      suggestRule?: string(name='SuggestRule', description='The rule content of the protection suggestion. The value is a string that consists of multiple parameters in the JSON format. Valid values:

*   **event_tags**: event type
*   **black_iplist**: IP address blacklist
*   **ip_baseline**: IP address
*   **freq_baseline**: throttling frequency
*   **client_id_baseline**: client information
*   **country_baseline**: country information
*   **province_baseline**: province information
*   **sensitive_type**: sensitive information', example='{
    "rule": "ClientRule",
    "client_id_baseline": ["Edge"]
}'),
      suggestType?: string(name='SuggestType', description='The rule type of the protection suggestion. Valid values:

*   **BotRule**: bot management rules
*   **BlackIPRule**: IP address blacklist rules
*   **WhiteIPRule**: IP address whitelist rules
*   **RateLimitRule**: throttling rules
*   **ClientRule**: client rules
*   **GeoRule**: region-related rules
*   **SensitiveRule**: sensitive information rules
*   **UnauthRule**: authentication rules', example='WhiteIPRule'),
    }
  ](name='Data', description='The protection suggestions.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DescribeApisecSuggestionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecSuggestionsResponseBody(name='body'),
}

/**
 * @summary Queries the protection suggestions for APIs.
 *
 * @param request DescribeApisecSuggestionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecSuggestionsResponse
 */
async function describeApisecSuggestionsWithOptions(request: DescribeApisecSuggestionsRequest, runtime: $RuntimeOptions): DescribeApisecSuggestionsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.apiId)) {
    query['ApiId'] = request.apiId;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecSuggestions',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the protection suggestions for APIs.
 *
 * @param request DescribeApisecSuggestionsRequest
 * @return DescribeApisecSuggestionsResponse
 */
async function describeApisecSuggestions(request: DescribeApisecSuggestionsRequest): DescribeApisecSuggestionsResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecSuggestionsWithOptions(request, runtime);
}

model DescribeApisecUserOperationsRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-wwo36ksck1e'),
  objectId?: string(name='ObjectId', description='The object ID of the operation record.

This parameter is required.', example='fe8723e92e2037245014ab62161bbec8'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aek2ax2y5****pi'),
  type?: string(name='Type', description='The type of the operation record. Valid values:

*   **abnormal**: risk detection
*   **event**: security event', example='event'),
}

model DescribeApisecUserOperationsResponseBody = {
  data?: [ 
    {
      fromStatus?: string(name='FromStatus', description='The state before the operation.

Valid values of the risk state:

*   **toBeConfirmed**
*   **confirmed**
*   **toBeFixed**
*   **fixed**
*   **ignored**

Valid values of the event state:

*   **toBeConfirmed**
*   **confirmed**
*   **ignored**', example='ignored'),
      note?: string(name='Note', description='The remarks.', example='Handled'),
      objectId?: string(name='ObjectId', description='The object ID of the operation record.', example='24d997acc48a67a01e09b9c5ad861287'),
      time?: long(name='Time', description='The time at which the operation was performed. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1685072214'),
      toStatus?: string(name='ToStatus', description='The state after the operation.

Valid values of the risk state:

*   **toBeConfirmed**
*   **confirmed**
*   **toBeFixed**
*   **fixed**
*   **ignored**

Valid values of the event state:

*   **toBeConfirmed**
*   **confirmed**
*   **ignored**', example='Confirmed'),
      type?: string(name='Type', description='The type of the operation record. Valid values:

*   **abnormal**: risk detection
*   **event**: security event', example='abnormal'),
      userId?: string(name='UserId', description='The user ID.', example='1610954****'),
    }
  ](name='Data', description='The operation records.'),
  requestId?: string(name='RequestId', description='The request ID.', example='C9825654-327B-5156-A570-847054B4CF10'),
}

model DescribeApisecUserOperationsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeApisecUserOperationsResponseBody(name='body'),
}

/**
 * @summary Queries user operation records in the API security module.
 *
 * @param request DescribeApisecUserOperationsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeApisecUserOperationsResponse
 */
async function describeApisecUserOperationsWithOptions(request: DescribeApisecUserOperationsRequest, runtime: $RuntimeOptions): DescribeApisecUserOperationsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.objectId)) {
    query['ObjectId'] = request.objectId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeApisecUserOperations',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries user operation records in the API security module.
 *
 * @param request DescribeApisecUserOperationsRequest
 * @return DescribeApisecUserOperationsResponse
 */
async function describeApisecUserOperations(request: DescribeApisecUserOperationsRequest): DescribeApisecUserOperationsResponse {
  var runtime = new $RuntimeOptions{};
  return describeApisecUserOperationsWithOptions(request, runtime);
}

model DescribeCertDetailRequest {
  certIdentifier?: string(name='CertIdentifier', description='The ID of the certificate.

This parameter is required.', example='123-cn-hangzhou'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-uax****3k0e'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeCertDetailResponseBody = {
  certDetail?: {
    afterDate?: long(name='AfterDate', description='The time when the certificate expires. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1976256736582'),
    beforeDate?: long(name='BeforeDate', description='The time when the certificate was issued. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1976256736582'),
    certIdentifier?: string(name='CertIdentifier', description='The ID of the certificate.', example='123-cn-hangzhou'),
    certName?: string(name='CertName', description='The name of the certificate.', example='testCertName'),
    commonName?: string(name='CommonName', description='The primary domain name, which is a common name.', example='*.xxxaliyun.com'),
    domain?: string(name='Domain', description='The domain name that is associated with the certificate.', example='demo.xxxaliyun.com'),
    sans?: [ string ](name='Sans', description='The other domain names that are associated with the certificate.'),
  }(name='CertDetail', description='The details of the certificate.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='3C115DBE-8E53-5A12-9CAF-FD3F****CDF6'),
}

model DescribeCertDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCertDetailResponseBody(name='body'),
}

/**
 * @summary Queries the details of a certificate, such as the certificate name, expiration time, issuance time, and associated domain name.
 *
 * @param request DescribeCertDetailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCertDetailResponse
 */
async function describeCertDetailWithOptions(request: DescribeCertDetailRequest, runtime: $RuntimeOptions): DescribeCertDetailResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.certIdentifier)) {
    query['CertIdentifier'] = request.certIdentifier;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeCertDetail',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details of a certificate, such as the certificate name, expiration time, issuance time, and associated domain name.
 *
 * @param request DescribeCertDetailRequest
 * @return DescribeCertDetailResponse
 */
async function describeCertDetail(request: DescribeCertDetailRequest): DescribeCertDetailResponse {
  var runtime = new $RuntimeOptions{};
  return describeCertDetailWithOptions(request, runtime);
}

model DescribeCertsRequest {
  algorithm?: string(name='Algorithm', description='The type of the encryption algorithm. Valid values:

*   **NotSM2**: The encryption algorithm is not the SM2 algorithm. This is the default value.
*   **SM2**: The encryption algorithm is the SM2 algorithm.', example='SM2'),
  domain?: string(name='Domain', description='The domain name.', example='example.aliyun.com'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-5yd****tb02'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Valid values: 1 to 100. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfmoiy****p2oq'),
}

model DescribeCertsResponseBody = {
  certs?: [ 
    {
      afterDate?: long(name='AfterDate', description='The expiration time.', example='1976256736582'),
      beforeDate?: long(name='BeforeDate', description='The effective time.', example='1976256836582'),
      certIdentifier?: string(name='CertIdentifier', description='The globally unique ID of the certificate. The value follows a "\\\\<Certificate ID>-ap-southeast-1" format. For example, if the ID of the certificate is 123, the value of the CertIdentifier parameter is 123-ap-southeast-1.', example='123-ap-southeast-1'),
      certName?: string(name='CertName', description='The name of the certificate.', example='waf1234'),
      commonName?: string(name='CommonName', description='The common name.', example='*.example.com'),
      domain?: string(name='Domain', description='The domain that is supported by the certificate.', example='www.example.com'),
      isChainCompleted?: boolean(name='IsChainCompleted', description='Indicates whether the certificate chain is complete. Valid values:

*   **true**
*   **false**', example='true'),
    }
  ](name='Certs', description='The certificates.'),
  requestId?: string(name='RequestId', description='The request ID.', example='19511B0D-5AE0-5600-BB8A-DC2C8345****'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='8'),
}

model DescribeCertsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCertsResponseBody(name='body'),
}

/**
 * @summary Queries the certificates issued for your domain names that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeCertsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCertsResponse
 */
async function describeCertsWithOptions(request: DescribeCertsRequest, runtime: $RuntimeOptions): DescribeCertsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.algorithm)) {
    query['Algorithm'] = request.algorithm;
  }
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeCerts',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the certificates issued for your domain names that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeCertsRequest
 * @return DescribeCertsResponse
 */
async function describeCerts(request: DescribeCertsRequest): DescribeCertsResponse {
  var runtime = new $RuntimeOptions{};
  return describeCertsWithOptions(request, runtime);
}

model DescribeCloudResourceAccessPortDetailsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  port?: string(name='Port', description='The port of the cloud service that is added to WAF.', example='443'),
  protocol?: string(name='Protocol', description='The type of the protocol. Valid values:

*   **http**
*   **https**', example='https'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceInstanceId?: string(name='ResourceInstanceId', description='The instance ID of the resource.

This parameter is required.', example='lb-2zeugkfj81jvo****4tqm'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  resourceProduct?: string(name='ResourceProduct', description='The cloud service. Valid values:

*   **clb4**: Layer 4 CLB.
*   **clb7**: Layer 7 CLB.
*   **ecs**: ECS.', example='clb7'),
}

model DescribeCloudResourceAccessPortDetailsResponseBody = {
  accessPortDetails?: [ 
    {
      certificates?: [ 
        {
          appliedType?: string(name='AppliedType', description='The type of the HTTPS certificate. Valid values:

*   **default**: default certificate.
*   **extension**: additional certificate.', example='default'),
          certificateId?: string(name='CertificateId', description='The ID of the certificate.', example='123-cn-hangzhou'),
          certificateName?: string(name='CertificateName', description='The name of the certificate.', example='cert-name1'),
        }
      ](name='Certificates', description='The certificates that are associated with the ports of cloud services.'),
      cipherSuite?: int32(name='CipherSuite', description='The type of the cipher suites. Valid values:

*   **1**: all cipher suites.
*   **2**: strong cipher suites.
*   **99**: custom cipher suites.', example='1'),
      customCiphers?: [ string ](name='CustomCiphers', description='The custom cipher suites that you want to add. This parameter is available only if you set **CipherSuite** to **99**.'),
      enableTLSv3?: boolean(name='EnableTLSv3', description='Indicates whether to support TLS 1.3. Valid values:

*   **true**
*   **false**', example='true'),
      http2Enabled?: boolean(name='Http2Enabled', description='Indicates whether to enable HTTP/2. Valid values:

*   **true**
*   **false**', example='True'),
      keepalive?: boolean(name='Keepalive', description='Indicates whether to enable the persistent connection feature. Valid values:

*   **true** (default)
*   **false:**', example='true'),
      keepaliveRequests?: int32(name='KeepaliveRequests', description='The number of reused persistent connections. Valid values: 60 to 1000.

>  This parameter specifies the number of requests that reuse persistent connections after you enable the persistent connection feature.', example='1000'),
      keepaliveTimeout?: int32(name='KeepaliveTimeout', description='The timeout period for idle persistent connections. Valid values: 10 to 3600. Default value: 15. Unit: seconds.

>  If no new requests are initiated over the idle persistent connection within the specified timeout period, the connection is closed.', example='10'),
      logHeaders?: [ 
        {
          key?: string(name='Key', description='The key of the custom header field.', example='key1'),
          value?: string(name='Value', description='The value of the custom header field.', example='value1'),
        }
      ](name='LogHeaders', description='The custom header field that you want to use to label requests that are processed by WAF.

>  This parameter is returned only when the traffic marking feature is enabled for the domain name.'),
      ownerUserId?: string(name='OwnerUserId', description='The ID of the Alibaba Cloud account to which the resource belongs.', example='123'),
      port?: int32(name='Port', description='The port of the cloud service that is added to WAF.', example='443'),
      protocol?: string(name='Protocol', description='The type of the protocol. Valid values:

*   **http**
*   **https**', example='https'),
      readTimeout?: int32(name='ReadTimeout', description='The timeout period for read connections. Unit: seconds. Valid values: 1 to 3600.', example='5'),
      status?: int32(name='Status', description='The status of the domain name. Valid values:

*   **1**: indicates that the port is available.
*   **2**: indicates that the port is being created.
*   **3**: indicates that the port is being modified.
*   **4**: indicates that the port is being released.', example='1'),
      TLSVersion?: string(name='TLSVersion', description='The version of the Transport Layer Security (TLS) protocol. Valid values:

*   **tlsv1**
*   **tlsv1.1**
*   **tlsv1.2**', example='tlsv1'),
      writeTimeout?: int32(name='WriteTimeout', description='The timeout period for write connections. Unit: seconds. Valid values: 1 to 3600.', example='1'),
      xffHeaderMode?: int32(name='XffHeaderMode', description='The method that WAF uses to obtain the originating IP address of a client. Valid values:

*   **0**: No Layer 7 proxies are deployed in front of WAF.
*   **1**: WAF reads the first value of the X-Forwarded-For (XFF) header field as the originating IP address of the client.
*   **2**: WAF reads the value of a custom header field as the originating IP address of the client.', example='0'),
      xffHeaders?: [ string ](name='XffHeaders', description='The custom header field that is used to obtain the originating IP address of a client. Specify the value in the ["header1","header2",...] format.

>  This parameter is required only if you set **XffHeaderMode** to 2.'),
      xffProto?: boolean(name='XffProto', description='Indicates whether to use the X-Forward-For-Proto header to identify the protocol used by WAF to forward requests to the origin server. Valid values:

*   **true** (default)
*   **false**', example='true'),
    }
  ](name='AccessPortDetails', description='The details of the ports of cloud services that are added to WAF.'),
  requestId?: string(name='RequestId', description='The request ID.', example='2EFCFE18-78F8-5079-B312-07***48B'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model DescribeCloudResourceAccessPortDetailsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCloudResourceAccessPortDetailsResponseBody(name='body'),
}

/**
 * @summary Queries a port of the cloud service that is added to Web Application Firewall (WAF). This operation is supported for only Elastic Compute Service (ECS) and Classic Load Balancer (CLB).
 *
 * @param request DescribeCloudResourceAccessPortDetailsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCloudResourceAccessPortDetailsResponse
 */
async function describeCloudResourceAccessPortDetailsWithOptions(request: DescribeCloudResourceAccessPortDetailsRequest, runtime: $RuntimeOptions): DescribeCloudResourceAccessPortDetailsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.port)) {
    query['Port'] = request.port;
  }
  if (!$isNull(request.protocol)) {
    query['Protocol'] = request.protocol;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceInstanceId)) {
    query['ResourceInstanceId'] = request.resourceInstanceId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceProduct)) {
    query['ResourceProduct'] = request.resourceProduct;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeCloudResourceAccessPortDetails',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a port of the cloud service that is added to Web Application Firewall (WAF). This operation is supported for only Elastic Compute Service (ECS) and Classic Load Balancer (CLB).
 *
 * @param request DescribeCloudResourceAccessPortDetailsRequest
 * @return DescribeCloudResourceAccessPortDetailsResponse
 */
async function describeCloudResourceAccessPortDetails(request: DescribeCloudResourceAccessPortDetailsRequest): DescribeCloudResourceAccessPortDetailsResponse {
  var runtime = new $RuntimeOptions{};
  return describeCloudResourceAccessPortDetailsWithOptions(request, runtime);
}

model DescribeCloudResourceAccessedPortsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceInstanceId?: string(name='ResourceInstanceId', description='The instance ID of the resource.

This parameter is required.', example='lb-bp1*****jqnnqk5uj2p'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekzwwkpn****5i'),
}

model DescribeCloudResourceAccessedPortsResponseBody = {
  http?: [ int32 ](name='Http', description='The HTTP ports.'),
  https?: [ int32 ](name='Https', description='The HTTPS ports.'),
  requestId?: string(name='RequestId', description='The request ID.', example='C1823E96-EF4B-5BD2-9E02-1D18****3ED8'),
}

model DescribeCloudResourceAccessedPortsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCloudResourceAccessedPortsResponseBody(name='body'),
}

/**
 * @summary Queries the ports of the cloud service that is added to Web Application Firewall (WAF). This operation is supported for only Elastic Compute Service (ECS) and Classic Load Balancer (CLB).
 *
 * @param request DescribeCloudResourceAccessedPortsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCloudResourceAccessedPortsResponse
 */
async function describeCloudResourceAccessedPortsWithOptions(request: DescribeCloudResourceAccessedPortsRequest, runtime: $RuntimeOptions): DescribeCloudResourceAccessedPortsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceInstanceId)) {
    query['ResourceInstanceId'] = request.resourceInstanceId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeCloudResourceAccessedPorts',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the ports of the cloud service that is added to Web Application Firewall (WAF). This operation is supported for only Elastic Compute Service (ECS) and Classic Load Balancer (CLB).
 *
 * @param request DescribeCloudResourceAccessedPortsRequest
 * @return DescribeCloudResourceAccessedPortsResponse
 */
async function describeCloudResourceAccessedPorts(request: DescribeCloudResourceAccessedPortsRequest): DescribeCloudResourceAccessedPortsResponse {
  var runtime = new $RuntimeOptions{};
  return describeCloudResourceAccessedPortsWithOptions(request, runtime);
}

model DescribeCloudResourcesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-lbj****cn0c'),
  ownerUserId?: string(name='OwnerUserId', description='The ID of the Alibaba Cloud account to which the resource belongs.', example='11769793******'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceDomain?: string(name='ResourceDomain', description='The domain name. You can use this parameter if you set ResourceProduct to fc or sae.', example='fc-domain-test'),
  resourceFunction?: string(name='ResourceFunction', description='The function name. You can use this parameter if you set ResourceProduct to fc.', example='fc-test'),
  resourceInstanceId?: string(name='ResourceInstanceId', description='The ID of the resource.', example='alb-43glijk0fr****gths'),
  resourceInstanceName?: string(name='ResourceInstanceName', description='The name of the instance that is added to WAF.', example='test-name'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm4gh****wela'),
  resourceName?: string(name='ResourceName', description='The name of the resource.', example='alb-name', deprecated=true),
  resourceProduct?: string(name='ResourceProduct', description='The cloud service to which the resource belongs. If you do not specify this parameter, the system automatically returns the Application Load Balancer (ALB), Microservices Engine (MSE), Function Compute, and Serverless App Engine (SAE) resources that are added to WAF. Valid values:

*   **alb**: ALB.
*   **mse**: MSE.
*   **fc**: Function Compute.
*   **sae**: SAE.
*   **ecs**: Elastic Compute Service (ECS).
*   **clb4**: Layer 4 Classic Load Balancer (CLB).
*   **clb7**: Layer 7 CLB.
*   **nlb**: Network Load Balancer (NLB).

>  Different cloud services are available in different regions. The specified cloud service must be available in the specified region.', example='alb'),
  resourceRegionId?: string(name='ResourceRegionId', description='The region ID of the resource. For information about region IDs, see the following table.

>  Different cloud services are available in different regions. The specified cloud service must be available in the specified region.', example='cn-beijing'),
  resourceRouteName?: string(name='ResourceRouteName', description='The route name. You can use this parameter if you set ResourceProduct to mse.', example='mse-default-traffic'),
}

model DescribeCloudResourcesResponseBody = {
  cloudResources?: [ 
    {
      httpPortCount?: int32(name='HttpPortCount', description='The number of the HTTP ports that are added to WAF.

>  This parameter is returned only if the cloud service is ECS or CLB.', example='1'),
      httpsPortCount?: int32(name='HttpsPortCount', description='The number of the HTTPS ports that are added to WAF.

>  This parameter is returned only if the cloud service is ECS or CLB.', example='1'),
      ownerUserId?: string(name='OwnerUserId', description='The ID of the Alibaba Cloud account to which the resource belongs.', example='11769793******'),
      resourceDomain?: string(name='ResourceDomain', description='The domain name. This parameter has a value only if the value of ResourceProduct is fc or sae.', example='test-resource-domain'),
      resourceFunction?: string(name='ResourceFunction', description='The function name. This parameter has a value only if the value of ResourceProduct is fc.', example='test-resource-function'),
      resourceInstance?: string(name='ResourceInstance', description='The ID of the resource.', example='alb-ffff****', deprecated=true),
      resourceInstanceId?: string(name='ResourceInstanceId', description='The ID of the instance that is added to WAF.', example='lb-uf60ub45fr9b***'),
      resourceInstanceIp?: string(name='ResourceInstanceIp', description='The IP address of the instance that is added to WAF.', example='1.1.1.1'),
      resourceInstanceName?: string(name='ResourceInstanceName', description='The name of the instance that is added to WAF.', example='test-name'),
      resourceName?: string(name='ResourceName', description='The name of the resource.', example='test-resource-name', deprecated=true),
      resourceProduct?: string(name='ResourceProduct', description='The cloud service to which the resource belongs. Valid values:

*   **alb**: ALB.
*   **mse**: MSE.
*   **fc**: Function Compute.
*   **sae**: SAE.
*   **ecs**: ECS.
*   **clb4**: Layer 4 CLB.
*   **clb7**: Layer 7 CLB.', example='alb'),
      resourceRegionId?: string(name='ResourceRegionId', description='The region ID of the resource.', example='cn-hangzhou'),
      resourceRouteName?: string(name='ResourceRouteName', description='The route name. This parameter has a value only if the value of ResourceProduct is mse.', example='test-route-name'),
      resourceService?: string(name='ResourceService', description='The service name. This parameter has a value only if the value of ResourceProduct is fc.', example='test-resource-service'),
    }
  ](name='CloudResources', description='The cloud service resources that are added to WAF.'),
  requestId?: string(name='RequestId', description='The request ID.', example='C327F81A-CCE2-5B21-817C-F93E29C5****'),
  totalCount?: long(name='TotalCount', description='The total number of cloud service resources returned.', example='121'),
}

model DescribeCloudResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCloudResourcesResponseBody(name='body'),
}

/**
 * @summary Queries cloud service resources that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeCloudResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCloudResourcesResponse
 */
async function describeCloudResourcesWithOptions(request: DescribeCloudResourcesRequest, runtime: $RuntimeOptions): DescribeCloudResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.ownerUserId)) {
    query['OwnerUserId'] = request.ownerUserId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceDomain)) {
    query['ResourceDomain'] = request.resourceDomain;
  }
  if (!$isNull(request.resourceFunction)) {
    query['ResourceFunction'] = request.resourceFunction;
  }
  if (!$isNull(request.resourceInstanceId)) {
    query['ResourceInstanceId'] = request.resourceInstanceId;
  }
  if (!$isNull(request.resourceInstanceName)) {
    query['ResourceInstanceName'] = request.resourceInstanceName;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceName)) {
    query['ResourceName'] = request.resourceName;
  }
  if (!$isNull(request.resourceProduct)) {
    query['ResourceProduct'] = request.resourceProduct;
  }
  if (!$isNull(request.resourceRegionId)) {
    query['ResourceRegionId'] = request.resourceRegionId;
  }
  if (!$isNull(request.resourceRouteName)) {
    query['ResourceRouteName'] = request.resourceRouteName;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeCloudResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries cloud service resources that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeCloudResourcesRequest
 * @return DescribeCloudResourcesResponse
 */
async function describeCloudResources(request: DescribeCloudResourcesRequest): DescribeCloudResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return describeCloudResourcesWithOptions(request, runtime);
}

model DescribeCnameCountRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='阿里云资源组ID。', example='rg-acfm***q'),
}

model DescribeCnameCountResponseBody = {
  cnameCount?: {
    cname?: long(name='Cname', description='The number of domain names that are added to WAF in CNAME record mode.', example='1'),
    hybridCloudCname?: long(name='HybridCloudCname', description='The number of domain names that are added to WAF in hybrid cloud reverse proxy mode.', example='1'),
    total?: long(name='Total', description='The total number of domain names that are added to WAF in CNAME record mode and hybrid cloud reverse proxy mode.', example='1'),
  }(name='CnameCount', description='The information about the number of domain names that are added to WAF in CNAME record mode and hybrid cloud reverse proxy mode.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='F35F45B0-5D6B-4238-BE02-A62D****E840'),
}

model DescribeCnameCountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCnameCountResponseBody(name='body'),
}

/**
 * @summary Queries the total number of domain names that are added to Web Application Firewall (WAF) in CNAME record mode and hybrid cloud reverse proxy mode.
 *
 * @param request DescribeCnameCountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCnameCountResponse
 */
async function describeCnameCountWithOptions(request: DescribeCnameCountRequest, runtime: $RuntimeOptions): DescribeCnameCountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeCnameCount',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the total number of domain names that are added to Web Application Firewall (WAF) in CNAME record mode and hybrid cloud reverse proxy mode.
 *
 * @param request DescribeCnameCountRequest
 * @return DescribeCnameCountResponse
 */
async function describeCnameCount(request: DescribeCnameCountRequest): DescribeCnameCountResponse {
  var runtime = new $RuntimeOptions{};
  return describeCnameCountWithOptions(request, runtime);
}

model DescribeDDoSStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance that you want to query.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeDDoSStatusResponseBody = {
  DDoSStatus?: [ 
    {
      eventType?: string(name='EventType', description='The type of events that are triggered by DDoS attacks. Valid values:

*   defense: traffic scrubbing events.
*   blackhole: blackhole filtering events.', example='blackhole'),
      status?: string(name='Status', description='Indicates whether DDoS attacks occur on specific domain names. Valid value:

*   **doing**: DDoS attacks occur on specific domain names.', example='doing'),
    }
  ](name='DDoSStatus', description='Indicates whether DDoS attacks occur on specific domain names.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-***'),
}

model DescribeDDoSStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDDoSStatusResponseBody(name='body'),
}

/**
 * @summary Checks whether DDoS attacks occur on specific domain names protected by a Web Application Firewall (WAF) instance.
 *
 * @param request DescribeDDoSStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDDoSStatusResponse
 */
async function describeDDoSStatusWithOptions(request: DescribeDDoSStatusRequest, runtime: $RuntimeOptions): DescribeDDoSStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDDoSStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Checks whether DDoS attacks occur on specific domain names protected by a Web Application Firewall (WAF) instance.
 *
 * @param request DescribeDDoSStatusRequest
 * @return DescribeDDoSStatusResponse
 */
async function describeDDoSStatus(request: DescribeDDoSStatusRequest): DescribeDDoSStatusResponse {
  var runtime = new $RuntimeOptions{};
  return describeDDoSStatusWithOptions(request, runtime);
}

model DescribeDefaultHttpsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-7pp26f1****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeDefaultHttpsResponseBody = {
  defaultHttps?: {
    certId?: string(name='CertId', description='The certificate ID.', example='123-cn-hangzhou'),
    cipherSuite?: string(name='CipherSuite', description='The type of the cipher suites. Valid values:

*   **1**: all cipher suites.
*   **2**: strong cipher suites.
*   **99**: custom cipher suites.', example='1'),
    customCiphers?: string(name='CustomCiphers', description='The custom cipher suite.', example='ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384'),
    enableTLSv3?: boolean(name='EnableTLSv3', description='Indicates whether TLS 1.3 is supported. Valid values:

*   **true**
*   **false**', example='true'),
    TLSVersion?: string(name='TLSVersion', description='The version of the TLS protocol. Valid values:

*   **tlsv1**
*   **tlsv1.1**
*   **tlsv1.2**', example='tlsv1'),
  }(name='DefaultHttps', description='The default SSL and TLS settings.'),
  requestId?: string(name='RequestId', description='The request ID.', example='F35F45B0-5D6B-4238-BE02-A62D****E840'),
}

model DescribeDefaultHttpsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefaultHttpsResponseBody(name='body'),
}

/**
 * @summary Queries the default SSL and Transport Layer Security (TLS) settings.
 *
 * @param request DescribeDefaultHttpsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefaultHttpsResponse
 */
async function describeDefaultHttpsWithOptions(request: DescribeDefaultHttpsRequest, runtime: $RuntimeOptions): DescribeDefaultHttpsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefaultHttps',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the default SSL and Transport Layer Security (TLS) settings.
 *
 * @param request DescribeDefaultHttpsRequest
 * @return DescribeDefaultHttpsResponse
 */
async function describeDefaultHttps(request: DescribeDefaultHttpsRequest): DescribeDefaultHttpsResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefaultHttpsWithOptions(request, runtime);
}

model DescribeDefenseResourceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-4xl****i60i'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The name of the protected object that you want to query. Only exact queries are supported.

This parameter is required.', example='example.aliyundoc.com-waf'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeDefenseResourceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='439AADF2-368C-5E98-B14E-3086****0573'),
  resource?: {
    acwCookieStatus?: int32(name='AcwCookieStatus', description='The status of the tracking cookie.

*   **0**: disabled.
*   **1**: enabled.', example='0'),
    acwSecureStatus?: int32(name='AcwSecureStatus', description='The status of the secure attribute of the tracking cookie.

*   **0**: disabled.
*   **1**: enabled.', example='0'),
    acwV3SecureStatus?: int32(name='AcwV3SecureStatus', description='The status of the secure attribute of the slider CAPTCHA cookie.

*   **0**: disabled.
*   **1**: enabled.', example='0'),
    customHeaders?: [ string ](name='CustomHeaders', description='The custom header fields.

>  If the value of XffStatus is 1, the first IP address in the specified header field is used as the originating IP address of the client to prevent X-Forwarded-For (XFF) forgery. If you specify multiple header fields, WAF reads the values of the header fields in sequence until the originating IP address is obtained. If the originating IP address cannot be obtained, the first IP address in the XFF header field is used as the originating IP address of the client.'),
    description?: string(name='Description', description='The description of the protected object.', example='This is Description'),
    detail?: map[string]any(name='Detail', description='The details of the protected object. Different key-value pairs indicate different attributes of the protected object.', example='{
"product": "waf",
 "domain": "demo.aliyundoc****.com"
}'),
    gmtCreate?: long(name='GmtCreate', description='The time when the protected object was created. Unit: milliseconds.', example='1607493144000'),
    gmtModified?: long(name='GmtModified', description='The time when the protected object was modified. Unit: milliseconds.', example='1691720010000'),
    ownerUserId?: string(name='OwnerUserId', description='The user ID (UID) of the Alibaba Cloud account to which the protected object belongs.', example='170457******9107'),
    pattern?: string(name='Pattern', description='The pattern used for the protected object.', example='domain'),
    product?: string(name='Product', description='The name of the cloud service.', example='alb'),
    resource?: string(name='Resource', description='The name of the protected object.', example='alb-rencs***'),
    resourceGroup?: string(name='ResourceGroup', description='The name of the protected object group to which the protected object belongs.', example='example_resource_group'),
    resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfmoiy****p2oq'),
    resourceOrigin?: string(name='ResourceOrigin', description='The origin of the protected object. Valid values:

*   **custom**
*   **access**', example='custom'),
    responseHeaders?: [ 
      {
        key?: string(name='Key', description='Specifies the key for a custom response header.', example='Header-Key'),
        value?: string(name='Value', description='Specifies the value for a custom response header.', example='Header-Value'),
      }
    ](name='ResponseHeaders', description='The response header.'),
    xffStatus?: int32(name='XffStatus', description='Indicates whether a Layer 7 proxy is deployed in front of WAF, such as Anti-DDoS Proxy and Alibaba Cloud CDN. Valid values:

*   **0**: No Layer 7 proxy is deployed.
*   **1**: A Layer 7 proxy is deployed.', example='0'),
  }(name='Resource', description='The protected object.'),
}

model DescribeDefenseResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseResourceResponseBody(name='body'),
}

/**
 * @summary Queries the information about a protected object.
 *
 * @param request DescribeDefenseResourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseResourceResponse
 */
async function describeDefenseResourceWithOptions(request: DescribeDefenseResourceRequest, runtime: $RuntimeOptions): DescribeDefenseResourceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseResource',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a protected object.
 *
 * @param request DescribeDefenseResourceRequest
 * @return DescribeDefenseResourceResponse
 */
async function describeDefenseResource(request: DescribeDefenseResourceRequest): DescribeDefenseResourceResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseResourceWithOptions(request, runtime);
}

model DescribeDefenseResourceGroupRequest {
  groupName?: string(name='GroupName', description='The name of the protected object group whose information you want to query.

This parameter is required.', example='group221'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeDefenseResourceGroupResponseBody = {
  group?: {
    description?: string(name='Description', description='The description of the protected object group.', example='test'),
    gmtCreate?: long(name='GmtCreate', description='The time when the protected object group was created.', example='23242312312'),
    gmtModified?: long(name='GmtModified', description='The most recent time when the protected object group was modified.', example='23242312312'),
    groupName?: string(name='GroupName', description='The name of the protected object group.', example='group1'),
    resourceList?: string(name='ResourceList', description='The protected objects in the protected object group. The protected objects are separated with commas (,).', example='test1.aliyundoc.com,test2.aliyundoc.com'),
  }(name='Group', description='The information about the protected object group.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='E67D21C6-5376-5F94-B745-70E08D03E3CB'),
}

model DescribeDefenseResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseResourceGroupResponseBody(name='body'),
}

/**
 * @summary Queries the information about a protected object group.
 *
 * @param request DescribeDefenseResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseResourceGroupResponse
 */
async function describeDefenseResourceGroupWithOptions(request: DescribeDefenseResourceGroupRequest, runtime: $RuntimeOptions): DescribeDefenseResourceGroupResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseResourceGroup',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information about a protected object group.
 *
 * @param request DescribeDefenseResourceGroupRequest
 * @return DescribeDefenseResourceGroupResponse
 */
async function describeDefenseResourceGroup(request: DescribeDefenseResourceGroupRequest): DescribeDefenseResourceGroupResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseResourceGroupWithOptions(request, runtime);
}

model DescribeDefenseResourceGroupNamesRequest {
  groupNameLike?: string(name='GroupNameLike', description='The name of the protected object group. Fuzzy queries are supported.', example='example-group'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-lbj****cc03'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **20**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekzwwk****cv5i'),
}

model DescribeDefenseResourceGroupNamesResponseBody = {
  groupNames?: [ string ](name='GroupNames', description='The names of the protected object groups.'),
  requestId?: string(name='RequestId', description='The request ID.', example='59DA4258-2F32-5095-B283-57AC****70B3'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='8'),
}

model DescribeDefenseResourceGroupNamesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseResourceGroupNamesResponseBody(name='body'),
}

/**
 * @summary Queries the names of protected object groups.
 *
 * @param request DescribeDefenseResourceGroupNamesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseResourceGroupNamesResponse
 */
async function describeDefenseResourceGroupNamesWithOptions(request: DescribeDefenseResourceGroupNamesRequest, runtime: $RuntimeOptions): DescribeDefenseResourceGroupNamesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.groupNameLike)) {
    query['GroupNameLike'] = request.groupNameLike;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseResourceGroupNames',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the names of protected object groups.
 *
 * @param request DescribeDefenseResourceGroupNamesRequest
 * @return DescribeDefenseResourceGroupNamesResponse
 */
async function describeDefenseResourceGroupNames(request: DescribeDefenseResourceGroupNamesRequest): DescribeDefenseResourceGroupNamesResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseResourceGroupNamesWithOptions(request, runtime);
}

model DescribeDefenseResourceGroupsRequest {
  groupNameLike?: string(name='GroupNameLike', description='The name of the protected object group that you want to query. Fuzzy queries are supported.', example='demoGroupName'),
  groupNames?: string(name='GroupNames', description='The names of the protected object groups that you want to query. Separate multiple names with commas (,).', example='groupName1,groupName2'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-wwo36****0i'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **20**.', example='20'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfmxc7lf****eq'),
}

model DescribeDefenseResourceGroupsResponseBody = {
  groups?: [ 
    {
      description?: string(name='Description', description='The description of the protected object group.', example='This is test description'),
      gmtCreate?: long(name='GmtCreate', description='The time when the protected object group was created. Unit: milliseconds.', example='1624343180000'),
      gmtModified?: long(name='GmtModified', description='The most recent time when the protected object group was modified. Unit: milliseconds.', example='1701656305000'),
      groupName?: string(name='GroupName', description='The name of the protected object group.', example='apptest'),
      resourceList?: string(name='ResourceList', description='The names of the protected objects that are added to the protected object group. Separate multiple protected objects with commas (,).', example='example02.aliyun-waf,example01.aliyun-waf'),
    }
  ](name='Groups', description='The list of protected object groups.'),
  requestId?: string(name='RequestId', description='The request ID.', example='BFEC5C77-049B-5E88-A5B6-CB0C****B66E'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model DescribeDefenseResourceGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseResourceGroupsResponseBody(name='body'),
}

/**
 * @summary Performs a pagination query to retrieve the information about protected object groups.
 *
 * @param request DescribeDefenseResourceGroupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseResourceGroupsResponse
 */
async function describeDefenseResourceGroupsWithOptions(request: DescribeDefenseResourceGroupsRequest, runtime: $RuntimeOptions): DescribeDefenseResourceGroupsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.groupNameLike)) {
    query['GroupNameLike'] = request.groupNameLike;
  }
  if (!$isNull(request.groupNames)) {
    query['GroupNames'] = request.groupNames;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseResourceGroups',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Performs a pagination query to retrieve the information about protected object groups.
 *
 * @param request DescribeDefenseResourceGroupsRequest
 * @return DescribeDefenseResourceGroupsResponse
 */
async function describeDefenseResourceGroups(request: DescribeDefenseResourceGroupsRequest): DescribeDefenseResourceGroupsResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseResourceGroupsWithOptions(request, runtime);
}

model DescribeDefenseResourceNamesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-9lb****5s03'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **20**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The name of the protected object that you want to query.', example='example.xxxxaliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekzd4c****pdwy'),
}

model DescribeDefenseResourceNamesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='C1823E96-EF4B-5BD2-9E02-1D18****3ED8'),
  resources?: [ string ](name='Resources', description='The names of the protected objects.'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='75'),
}

model DescribeDefenseResourceNamesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseResourceNamesResponseBody(name='body'),
}

/**
 * @summary Performs a pagination query to retrieve the names of protected objects.
 *
 * @param request DescribeDefenseResourceNamesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseResourceNamesResponse
 */
async function describeDefenseResourceNamesWithOptions(request: DescribeDefenseResourceNamesRequest, runtime: $RuntimeOptions): DescribeDefenseResourceNamesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseResourceNames',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Performs a pagination query to retrieve the names of protected objects.
 *
 * @param request DescribeDefenseResourceNamesRequest
 * @return DescribeDefenseResourceNamesResponse
 */
async function describeDefenseResourceNames(request: DescribeDefenseResourceNamesRequest): DescribeDefenseResourceNamesResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseResourceNamesWithOptions(request, runtime);
}

model DescribeDefenseResourceTemplatesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-9lb36****0e'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The name of the protected object or protected object group that you want to query.

This parameter is required.', example='xxxxxhemicals.cn-waf'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aek2ax2y5****pi'),
  resourceType?: string(name='ResourceType', description='The type of the protected resource. Valid values:

*   **single**: protected object. This is the default value.
*   **group**: protected object group.', example='single'),
  ruleId?: long(name='RuleId', description='The ID of the protection rule.', example='20111098'),
  ruleName?: string(name='RuleName', description='The name of the rule.', example='demoRuleName'),
  ruleType?: string(name='RuleType', description='The type of the protection rule. Valid values:

*   **defense**: defense rule. This is the default value.
*   **whitelist**: whitelist rule.', example='whitelist'),
  templateName?: string(name='TemplateName', description='The name of the protection rule template.', example='test221'),
}

model DescribeDefenseResourceTemplatesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='2305CEB0-BA5A-5543-A1D3-3F1D0891****'),
  templates?: [ 
    {
      defenseScene?: string(name='DefenseScene', description='The scenario in which the protection template is used.

*   **waf_group**: basic protection.
*   **antiscan**: scan protection.
*   **ip_blacklist**: IP address blacklist.
*   **custom_acl**: custom rule.
*   **whitelist**: whitelist.
*   **region_block**: region blacklist.
*   **custom_response**: custom response.
*   **cc**: HTTP flood protection.
*   **tamperproof**: website tamper-proofing.
*   **dlp**: data leakage prevention.', example='whitelist'),
      defenseSubScene?: string(name='DefenseSubScene', description='The sub-scenario in which the template is used. Valid values:

*   **web**: bot management for website protection.
*   **app**: bot management for app protection.
*   **basic**: bot management for basic protection.', example='basic'),
      description?: string(name='Description', description='The description of the protection template.', example='test'),
      gmtModified?: long(name='GmtModified', description='The time when the protection template was created. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1692930539000'),
      templateId?: long(name='TemplateId', description='The ID of the protection template.', example='12345'),
      templateName?: string(name='TemplateName', description='The name of the protection template.', example='TestTemplateName'),
      templateOrigin?: string(name='TemplateOrigin', description='The origin of the protection template. The value custom indicates that the template is a custom template created by the user.', example='custom'),
      templateStatus?: int32(name='TemplateStatus', description='The status of the protection template. Valid values:

*   **0**: disabled.
*   **1**: enabled.', example='1'),
      templateType?: string(name='TemplateType', description='The type of the protection template. Valid values:

*   **user_default**: default template.
*   **user_custom**: custom template.', example='user_custom'),
    }
  ](name='Templates', description='The protection templates.'),
}

model DescribeDefenseResourceTemplatesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseResourceTemplatesResponseBody(name='body'),
}

/**
 * @summary Queries the protection templates that are associated with a protected object or protected object group.
 *
 * @param request DescribeDefenseResourceTemplatesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseResourceTemplatesResponse
 */
async function describeDefenseResourceTemplatesWithOptions(request: DescribeDefenseResourceTemplatesRequest, runtime: $RuntimeOptions): DescribeDefenseResourceTemplatesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!$isNull(request.ruleName)) {
    query['RuleName'] = request.ruleName;
  }
  if (!$isNull(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!$isNull(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseResourceTemplates',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the protection templates that are associated with a protected object or protected object group.
 *
 * @param request DescribeDefenseResourceTemplatesRequest
 * @return DescribeDefenseResourceTemplatesResponse
 */
async function describeDefenseResourceTemplates(request: DescribeDefenseResourceTemplatesRequest): DescribeDefenseResourceTemplatesResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseResourceTemplatesWithOptions(request, runtime);
}

model DescribeDefenseResourcesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  pageNumber?: int32(name='PageNumber', description='The page number of the paginated results Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of results per page. Default value: **10**.', example='10'),
  query?: string(name='Query', description='The query conditions. Specify the value of this parameter as a string in the JSON format.

>  The results vary based on the query condition. For more information, see the "**Query parameters**" section in this topic.', example='{\\\\"product\\\\":\\\\"waf\\\\"}'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='Tagkey1'),
      value?: string(name='Value', description='The tag value.', example='TagValue1'),
    }
  ](name='Tag', description='The tag of the resource. You can specify up to 20 tags.'),
}

model DescribeDefenseResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='618F2626-DB27-5187-8C6C-4E61A491DF29'),
  resources?: [ 
    {
      acwCookieStatus?: int32(name='AcwCookieStatus', description='The status of the tracking cookie.

*   **0**: disabled
*   **1**: enabled. This is the default value.', example='1'),
      acwSecureStatus?: int32(name='AcwSecureStatus', description='The status of the secure attribute of the tracking cookie.

*   **0**: disabled. This is the default value.
*   **1**: enabled.', example='0'),
      acwV3SecureStatus?: int32(name='AcwV3SecureStatus', description='The status of the secure attribute of the slider CAPTCHA cookie.

*   **0**: disabled. This is the default value.
*   **1**: enabled.', example='0'),
      customHeaders?: [ string ](name='CustomHeaders', description='The custom header fields that are used to identify the originating IP addresses of clients. If the value of XffStatus is 1 and CustomHeaders is left empty, the first IP addresses in the XFF header fields are used as the originating IP addresses of clients.'),
      description?: string(name='Description', description='The description of the protected object.', example='test'),
      detail?: map[string]any(name='Detail', description='The description of the protected object. Different key-value pairs in a map indicate different properties of the protected object.'),
      gmtCreate?: long(name='GmtCreate', description='The creation time of the protected object. Unit: seconds.', example='1652149203187'),
      gmtModified?: long(name='GmtModified', description='The most recent modification time of the protected object. Unit: seconds.', example='1665633032000'),
      ownerUserId?: string(name='OwnerUserId', description='The Alibaba Cloud account to which the protected object belongs. You can specify this parameter to query protected objects that belong to a specific Alibaba Cloud account. Exact match is supported.', example='135*********46'),
      pattern?: string(name='Pattern', description='The protection pattern.', example='domain'),
      product?: string(name='Product', description='The name of the cloud service.', example='alb'),
      resource?: string(name='Resource', description='The name of the protected object.', example='alb-rencs***'),
      resourceGroup?: string(name='ResourceGroup', description='The name of the protected object group to which the protected object belongs.', example='test'),
      resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
      resourceOrigin?: string(name='ResourceOrigin', description='The origin of the protected object.', example='custom'),
      responseHeaders?: [ 
        {
          key?: string(name='Key', description='Specifies the key for a custom response header.', example='Header-Key'),
          value?: string(name='Value', description='Specifies the value for a custom response header.', example='Header-Value'),
        }
      ](name='ResponseHeaders', description='The response header.'),
      xffStatus?: int32(name='XffStatus', description='Indicates whether the X-Forwarded-For (XFF) header is used.', example='1'),
    }
  ](name='Resources', description='The protected objects.'),
  totalCount?: long(name='TotalCount', description='The total number of entries that are returned.', example='73'),
}

model DescribeDefenseResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseResourcesResponseBody(name='body'),
}

/**
 * @summary Queries protected objects by page.
 *
 * @param request DescribeDefenseResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseResourcesResponse
 */
async function describeDefenseResourcesWithOptions(request: DescribeDefenseResourcesRequest, runtime: $RuntimeOptions): DescribeDefenseResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.query)) {
    query['Query'] = request.query;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries protected objects by page.
 *
 * @param request DescribeDefenseResourcesRequest
 * @return DescribeDefenseResourcesResponse
 */
async function describeDefenseResources(request: DescribeDefenseResourcesRequest): DescribeDefenseResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseResourcesWithOptions(request, runtime);
}

model DescribeDefenseRuleRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleId?: long(name='RuleId', description='The ID of the protection rule that you want to query.

This parameter is required.', example='20026192'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template to which the protection rule that you want to query belongs.', example='10318'),
}

model DescribeDefenseRuleResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
  rule?: {
    config?: string(name='Config', description='The details of the protection rule. The value is a JSON string that contains multiple parameters. For more information, see the "**Protection rule parameters**" section of the [CreateDefenseRule](~~CreateDefenseRule~~) topic.', example='{\\\\"status\\\\":1,\\\\"policyId\\\\":1012,\\\\"action\\\\":\\\\"block\\\\"}'),
    defenseOrigin?: string(name='DefenseOrigin', description='The origin of the protection rule. Valid values:

*   **custom:** The protection rule is created by the user.
*   **system:** The protection rule is automatically generated by the system.', example='custom'),
    defenseScene?: string(name='DefenseScene', description='The scenario in which the protection rule is used. For more information, see the description of **DefenseScene** in the [CreateDefenseRule](~~CreateDefenseRule~~) topic.', example='waf_group'),
    gmtModified?: long(name='GmtModified', description='The most recent time when the protection rule was modified.', example='1665196746000'),
    ruleId?: long(name='RuleId', description='The ID of the protection rule.', example='2732975'),
    ruleName?: string(name='RuleName', description='The name of the protection rule.', example='test1'),
    status?: int32(name='Status', description='The status of the protection rule. Valid values:

*   **0:** disabled.
*   **1:** enabled.', example='1'),
    templateId?: long(name='TemplateId', description='The ID of the protection rule template.', example='9114'),
  }(name='Rule', description='The configurations of the protection rule. The value is a JSON string that contains multiple parameters.'),
}

model DescribeDefenseRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseRuleResponseBody(name='body'),
}

/**
 * @summary Queries a protection rule.
 *
 * @param request DescribeDefenseRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseRuleResponse
 */
async function describeDefenseRuleWithOptions(request: DescribeDefenseRuleRequest, runtime: $RuntimeOptions): DescribeDefenseRuleResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseRule',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a protection rule.
 *
 * @param request DescribeDefenseRuleRequest
 * @return DescribeDefenseRuleResponse
 */
async function describeDefenseRule(request: DescribeDefenseRuleRequest): DescribeDefenseRuleResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseRuleWithOptions(request, runtime);
}

model DescribeDefenseRulesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  query?: string(name='Query', description='The query conditions. Specify a string that contains multiple parameters in the JSON format.

>  The results vary based on the query conditions. For more information, see the "**Query parameters**" section in this topic.', example='{\\\\\\\\"name\\\\\\\\":\\\\\\\\"IP address blocking_20220822_10\\\\\\\\",\\\\\\\\"scene\\\\\\\\":\\\\\\\\"custom_acl\\\\\\\\",\\\\\\\\"templateId\\\\\\\\":5327}'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleType?: string(name='RuleType', description='The type of protection rule that you want to query. Valid values:

*   **whitelist:** whitelist rule.
*   **defense:** defense rule. This is the default value.', example='whitelist'),
}

model DescribeDefenseRulesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='80736FA5-FA87-55F6-AA69-C5477C6FE6D0'),
  rules?: [ 
    {
      actionExternal?: string(name='ActionExternal'),
      config?: string(name='Config', description='The details of the protection rule. The value is a string that contains multiple parameters in the JSON format. For more information, see the "**Rule parameters**" section in the [CreateDefenseRule](~~CreateDefenseRule~~) topic.', example='{\\\\"policyId\\\\":1012,\\\\"action\\\\":\\\\"block\\\\"}'),
      defenseOrigin?: string(name='DefenseOrigin', description='The origin of the protection rule. Valid values:

*   **custom:** The protection rule is created by the user.
*   **system:** The protection rule is automatically generated by the system.', example='custom'),
      defenseScene?: string(name='DefenseScene', description='The protection module for which the protection rule is created. Valid values:

*   **waf_group**: the basic protection rule module.
*   **waf_base_compliance**: the protocol compliance feature of the basic protection rule module.
*   **waf_base_sema**: the semantic analysis feature of the basic protection rule module.
*   **cc**: the HTTP flood protection module.
*   **antiscan_dirscan**: the directory traversal blocking feature of the scan protection module.
*   **antiscan_highfreq**: the high-frequency scanning blocking feature of the scan protection module.
*   **antiscan_scantools**: the scanner blocking feature of the scan protection module.
*   **ip_blacklist**: the IP address blacklist module.
*   **custom_acl**: the custom rule module.
*   **region_block**: the region blacklist module.
*   **tamperproof**: the website tamper-proofing module.
*   **dlp**: the data leakage prevention module.
*   **custom_response_block**: the custom response module.', example='waf_group'),
      description?: string(name='Description'),
      detailRuleIds?: string(name='DetailRuleIds'),
      externalInfo?: string(name='ExternalInfo'),
      gmtCreate?: long(name='GmtCreate'),
      gmtModified?: long(name='GmtModified', description='The most recent time when the protection rule was modified.', example='1665460629000'),
      ruleId?: long(name='RuleId', description='The ID of the protection rule.', example='42755'),
      ruleName?: string(name='RuleName', description='The name of the protection rule.', example='rules_41'),
      ruleType?: string(name='RuleType'),
      status?: int32(name='Status', description='The status of the protection rule. Valid values:

*   **0:** disabled.
*   **1:** enabled.', example='1'),
      templateId?: long(name='TemplateId', description='The ID of the protection rule template.', example='5673'),
    }
  ](name='Rules', description='The protection rules.'),
  totalCount?: long(name='TotalCount', description='The total number of returned entries.', example='2'),
}

model DescribeDefenseRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseRulesResponseBody(name='body'),
}

/**
 * @summary Queries protection rules by page.
 *
 * @param request DescribeDefenseRulesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseRulesResponse
 */
async function describeDefenseRulesWithOptions(request: DescribeDefenseRulesRequest, runtime: $RuntimeOptions): DescribeDefenseRulesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.query)) {
    query['Query'] = request.query;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseRules',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries protection rules by page.
 *
 * @param request DescribeDefenseRulesRequest
 * @return DescribeDefenseRulesResponse
 */
async function describeDefenseRules(request: DescribeDefenseRulesRequest): DescribeDefenseRulesResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseRulesWithOptions(request, runtime);
}

model DescribeDefenseTemplateRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template.

This parameter is required.', example='1333'),
}

model DescribeDefenseTemplateResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
  template?: {
    defenseScene?: string(name='DefenseScene', description='The scenario in which the template is used. For more information, see the description of the **DefenseScene** parameter in the [CreateDefenseRule](~~CreateDefenseRule~~) topic.', example='waf_group'),
    defenseSubScene?: string(name='DefenseSubScene', description='The sub-scenario in which the template is used. Valid values:

*   **web**: The template is a bot management template that is used for website protection.
*   **app**: The template is a bot management template that is used for app protection.
*   **basic**: The template is a bot management template that is used for basic protection.', example='app'),
    description?: string(name='Description', description='The description of the protection rule template.', example='test'),
    gmtModified?: long(name='GmtModified', description='The most recent time when the protection rule template was modified.', example='1665283642000'),
    templateId?: long(name='TemplateId', description='The ID of the protection rule template.', example='10097'),
    templateName?: string(name='TemplateName', description='The name of the protection rule template.', example='test0621'),
    templateOrigin?: string(name='TemplateOrigin', description='The origin of the protection rule template. If the value of this parameter is custom, the protection rule template is created by the user.', example='custom'),
    templateStatus?: int32(name='TemplateStatus', description='The status of the protection rule template. Valid values:

*   **0:** disabled.
*   **1:** enabled.', example='1'),
    templateType?: string(name='TemplateType', description='The type of the protection rule template. Valid values:

*   **user_default:** default template.
*   **user_custom:** custom template.', example='user_default'),
  }(name='Template', description='The information about the template.'),
}

model DescribeDefenseTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseTemplateResponseBody(name='body'),
}

/**
 * @summary Queries a protection rule template.
 *
 * @param request DescribeDefenseTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseTemplateResponse
 */
async function describeDefenseTemplateWithOptions(request: DescribeDefenseTemplateRequest, runtime: $RuntimeOptions): DescribeDefenseTemplateResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseTemplate',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a protection rule template.
 *
 * @param request DescribeDefenseTemplateRequest
 * @return DescribeDefenseTemplateResponse
 */
async function describeDefenseTemplate(request: DescribeDefenseTemplateRequest): DescribeDefenseTemplateResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseTemplateWithOptions(request, runtime);
}

model DescribeDefenseTemplateValidGroupsRequest {
  defenseScene?: string(name='DefenseScene', description='The scenario in which the protection template is used.

*   **waf_group**: basic protection.
*   **antiscan**: scan protection.
*   **ip_blacklist**: IP address blacklist.
*   **custom_acl**: custom rule.
*   **whitelist**: whitelist.
*   **region_block**: region blacklist.
*   **custom_response**: custom response.
*   **cc**: HTTP flood protection.
*   **tamperproof**: website tamper-proofing.
*   **dlp**: data leakage prevention.

This parameter is required.', example='region_block'),
  groupName?: string(name='GroupName', description='The name of the protected object group that you want to query.', example='group221'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-nwy****pf0e'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **20**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm2th****v6ay'),
  templateId?: long(name='TemplateId', description='The ID of the protection template.', example='12345'),
}

model DescribeDefenseTemplateValidGroupsResponseBody = {
  groups?: [ string ](name='Groups', description='The names of the protected object groups.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='6EA4B39A-9C0C-5E57-993E-30B6****3AD0'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='27'),
}

model DescribeDefenseTemplateValidGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseTemplateValidGroupsResponseBody(name='body'),
}

/**
 * @summary Queries the names of protected object groups for which a protection template can take effect.
 *
 * @param request DescribeDefenseTemplateValidGroupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseTemplateValidGroupsResponse
 */
async function describeDefenseTemplateValidGroupsWithOptions(request: DescribeDefenseTemplateValidGroupsRequest, runtime: $RuntimeOptions): DescribeDefenseTemplateValidGroupsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.defenseScene)) {
    query['DefenseScene'] = request.defenseScene;
  }
  if (!$isNull(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseTemplateValidGroups',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the names of protected object groups for which a protection template can take effect.
 *
 * @param request DescribeDefenseTemplateValidGroupsRequest
 * @return DescribeDefenseTemplateValidGroupsResponse
 */
async function describeDefenseTemplateValidGroups(request: DescribeDefenseTemplateValidGroupsRequest): DescribeDefenseTemplateValidGroupsResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseTemplateValidGroupsWithOptions(request, runtime);
}

model DescribeDefenseTemplatesRequest {
  defenseScene?: string(name='DefenseScene', description='The scenario in which the protection template is used.

*   **waf_group**: basic protection.
*   **antiscan**: scan protection.
*   **ip_blacklist**: IP address blacklist.
*   **custom_acl**: custom rule.
*   **whitelist**: whitelist.
*   **region_block**: region blacklist.
*   **custom_response**: custom response.
*   **cc**: HTTP flood protection.
*   **tamperproof**: website tamper-proofing.
*   **dlp**: data leakage prevention.', example='region_block'),
  defenseSubScene?: string(name='DefenseSubScene', description='The sub-scenario in which the protection template is used. Valid values:

*   **web**: bot management for website protection.
*   **app**: bot management for app protection.
*   **basic**: bot management for basic protection.', example='basic'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-pe33b****03'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **20**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The name of the protected object or protected object group.

>  If you specify ResourceType, you must specify this parameter.', example='xxxqiu.cc-ecs'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfmvyknl****fa'),
  resourceType?: string(name='ResourceType', description='The type of the protected resource. Valid values:

*   **single**: protected object. This is the default value.
*   **group**: protected object group.

>  If you specify Resource, you must specify this parameter.', example='single'),
  templateId?: long(name='TemplateId', description='The ID of the protection template.', example='12345'),
  templateIds?: string(name='TemplateIds', description='The IDs of the protection templates that you want to query. Separate multiple template IDs with commas (,).', example='189731,189539,189538,189531,189540,189542,189541'),
  templateName?: string(name='TemplateName', description='The name of the protection template.', example='testTemplateName'),
  templateType?: string(name='TemplateType', description='The type of the protection template. Valid values:

*   **user_default**: default template.
*   **user_custom**: custom template.', example='user_default'),
}

model DescribeDefenseTemplatesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='4F26D2F1-E288-5104-8518-05E240E3****'),
  templates?: [ 
    {
      defenseScene?: string(name='DefenseScene', description='The scenario in which the protection template is used.

*   **waf_group**: basic protection.
*   **antiscan**: scan protection.
*   **ip_blacklist**: IP address blacklist.
*   **custom_acl**: custom rule.
*   **whitelist**: whitelist.
*   **region_block**: region blacklist.
*   **custom_response**: custom response.
*   **cc**: HTTP flood protection.
*   **tamperproof**: website tamper-proofing.
*   **dlp**: data leakage prevention.', example='whitelist'),
      defenseSubScene?: string(name='DefenseSubScene', description='The sub-scenario in which the protection template is used. Valid values:

*   **web**: bot management for website protection.
*   **app**: bot management for app protection.
*   **basic**: bot management for basic protection.', example='basic'),
      description?: string(name='Description', description='The description of the protection template.', example='test'),
      gmtModified?: long(name='GmtModified', description='The time when the protection template was created. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1683776070000'),
      templateId?: long(name='TemplateId', description='The ID of the protection template.', example='12345'),
      templateName?: string(name='TemplateName', description='The name of the protection template.', example='testTemplateName'),
      templateOrigin?: string(name='TemplateOrigin', description='The origin of the protection template. The value custom indicates that the protection template is a custom template created by the user.', example='custom'),
      templateStatus?: int32(name='TemplateStatus', description='The status of the protection template. Valid values:

*   **0**: disabled.
*   **1**: enabled.', example='1'),
      templateType?: string(name='TemplateType', description='The type of the protection template. Valid values:

*   **user_default**: default template.
*   **user_custom**: custom template.', example='user_custom'),
    }
  ](name='Templates', description='The protection templates.'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='100'),
}

model DescribeDefenseTemplatesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefenseTemplatesResponseBody(name='body'),
}

/**
 * @summary Performs a paging query to retrieve protection templates.
 *
 * @param request DescribeDefenseTemplatesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefenseTemplatesResponse
 */
async function describeDefenseTemplatesWithOptions(request: DescribeDefenseTemplatesRequest, runtime: $RuntimeOptions): DescribeDefenseTemplatesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.defenseScene)) {
    query['DefenseScene'] = request.defenseScene;
  }
  if (!$isNull(request.defenseSubScene)) {
    query['DefenseSubScene'] = request.defenseSubScene;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  if (!$isNull(request.templateIds)) {
    query['TemplateIds'] = request.templateIds;
  }
  if (!$isNull(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  if (!$isNull(request.templateType)) {
    query['TemplateType'] = request.templateType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDefenseTemplates',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Performs a paging query to retrieve protection templates.
 *
 * @param request DescribeDefenseTemplatesRequest
 * @return DescribeDefenseTemplatesResponse
 */
async function describeDefenseTemplates(request: DescribeDefenseTemplatesRequest): DescribeDefenseTemplatesResponse {
  var runtime = new $RuntimeOptions{};
  return describeDefenseTemplatesWithOptions(request, runtime);
}

model DescribeDomainDNSRecordRequest {
  domain?: string(name='Domain', description='The domain name whose DNS settings you want to check.

This parameter is required.', example='xxx.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-nwy****is02'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeDomainDNSRecordResponseBody = {
  DNSStatus?: string(name='DNSStatus', description='The status of the DNS settings. Valid values:

*   **cnameMatched**: The DNS settings are properly configured.
*   **vipMatched**: An A record maps the domain name to the WAF virtual IP address (VIP).
*   **wafVip**: An A record maps the domain name to another WAF VIP.
*   **unRecord**: The domain name does not have a DNS record.
*   **unUsed**: The domain name is not pointed to WAF.
*   **checkTimeout**: The check times out.', example='cnameMatched'),
  requestId?: string(name='RequestId', description='The request ID.', example='D827FCFE-90A7-4330-9326-D33C8B4C****'),
}

model DescribeDomainDNSRecordResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDomainDNSRecordResponseBody(name='body'),
}

/**
 * @summary Checks whether the Domain Name System (DNS) settings of a domain name are properly configured.
 *
 * @param request DescribeDomainDNSRecordRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDomainDNSRecordResponse
 */
async function describeDomainDNSRecordWithOptions(request: DescribeDomainDNSRecordRequest, runtime: $RuntimeOptions): DescribeDomainDNSRecordResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDomainDNSRecord',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Checks whether the Domain Name System (DNS) settings of a domain name are properly configured.
 *
 * @param request DescribeDomainDNSRecordRequest
 * @return DescribeDomainDNSRecordResponse
 */
async function describeDomainDNSRecord(request: DescribeDomainDNSRecordRequest): DescribeDomainDNSRecordResponse {
  var runtime = new $RuntimeOptions{};
  return describeDomainDNSRecordWithOptions(request, runtime);
}

model DescribeDomainDetailRequest {
  domain?: string(name='Domain', description='The domain name that you want to query.

This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
}

model DescribeDomainDetailResponseBody = {
  certDetail?: {
    commonName?: string(name='CommonName', description='The domain name of your website.', example='test.aliyundoc.com'),
    endTime?: long(name='EndTime', description='The end of the validity period of the SSL certificate. The value is in the UNIX timestamp format. Unit: milliseconds.', example='1685590400000'),
    id?: string(name='Id', description='The ID of the SSL certificate.', example='123-cn-hangzhou'),
    name?: string(name='Name', description='The name of the SSL certificate.', example='test-cert-name'),
    sans?: [ string ](name='Sans', description='All domain names that are bound to the certificate.'),
    startTime?: long(name='StartTime', description='The beginning of the validity period of the SSL certificate. The value is in the UNIX timestamp format. Unit: milliseconds.', example='1677772800000'),
  }(name='CertDetail', description='The details of the SSL certificate.'),
  cname?: string(name='Cname', description='The CNAME that is assigned by WAF to the domain name.', example='xxxxxcvdaf.****.com'),
  domain?: string(name='Domain', description='The domain name.', example='www.aliyundoc.com'),
  listen?: {
    certId?: long(name='CertId', description='The ID of the certificate.', example='123'),
    cipherSuite?: long(name='CipherSuite', description='The type of the cipher suites. Valid values:

*   **1:** all cipher suites.
*   **2:** strong cipher suites.
*   **99:** custom cipher suites.', example='2'),
    customCiphers?: [ string ](name='CustomCiphers', description='An array of custom cipher suites.'),
    enableTLSv3?: boolean(name='EnableTLSv3', description='Indicates whether TLS 1.3 is supported. Valid values:

*   **true:** TLS 1.3 is supported.
*   **false:** TLS 1.3 is not supported.', example='true'),
    exclusiveIp?: boolean(name='ExclusiveIp', description='Indicates whether an exclusive IP address is enabled. Valid values:

*   **true:** An exclusive IP address is enabled for the domain name.
*   **false:** No exclusive IP addresses are enabled for the domain name.', example='true'),
    focusHttps?: boolean(name='FocusHttps', description='Indicates whether HTTP to HTTPS redirection is enabled for the domain name. Valid values:

*   **true:** HTTP to HTTPS redirection is enabled.
*   **false:** HTTP to HTTPS redirection is disabled.', example='true'),
    http2Enabled?: boolean(name='Http2Enabled', description='Indicates whether HTTP/2 is enabled. Valid values:

*   **true:** HTTP/2 is enabled.
*   **false:** HTTP/2 is disabled.', example='true'),
    httpPorts?: [ long ](name='HttpPorts', description='An array of HTTP listener ports.'),
    httpsPorts?: [ long ](name='HttpsPorts', description='An array of HTTPS listener ports.'),
    IPv6Enabled?: boolean(name='IPv6Enabled', description='Indicates whether IPv6 is enabled. Valid values:

*   **true:** IPv6 is enabled.
*   **false:** IPv6 is disabled.', example='true'),
    protectionResource?: string(name='ProtectionResource', description='The type of protection resource that is used. Valid values:

*   **share:** shared cluster.
*   **gslb:** shared cluster-based intelligent load balancing.', example='share'),
    SM2AccessOnly?: boolean(name='SM2AccessOnly', description='Indicates whether only SM certificate-based clients can access the domain name. This parameter is returned only if the value of SM2Enabled is true. Valid values:

*   true
*   false', example='true'),
    SM2CertId?: string(name='SM2CertId', description='The ID of the SM certificate that is added. This parameter is returned only if the value of SM2Enabled is true.', example='123-cn-hangzhou'),
    SM2Enabled?: boolean(name='SM2Enabled', description='Indicates whether SM certificate-based verification is enabled. Valid values:

*   **true**
*   **false**', example='true'),
    TLSVersion?: string(name='TLSVersion', description='The version of the Transport Layer Security (TLS) protocol. Valid values:

*   **tlsv1**
*   **tlsv1.1**
*   **tlsv1.2**', example='tlsv1.2'),
    xffHeaderMode?: long(name='XffHeaderMode', description='The method that WAF uses to obtain the actual IP address of a client. Valid values:

*   **0:** No Layer 7 proxies are deployed in front of WAF.
*   **1:** WAF reads the first value of the X-Forwarded-For (XFF) header field as the actual IP address of the client.
*   **2:** WAF reads the value of a custom header field as the actual IP address of the client.', example='2'),
    xffHeaders?: [ string ](name='XffHeaders', description='An array of custom header fields that are used to obtain the actual IP address of a client.'),
  }(name='Listen', description='The configurations of the listeners.'),
  redirect?: {
    backends?: [ 
      {
        backend?: string(name='Backend', description='The IP address or domain name of the origin server.', example='1.1.XX.XX'),
      }
    ](name='Backends', description='An array of addresses of origin servers.'),
    backupBackends?: [ 
      {
        backend?: string(name='Backend', description='The back-to-origin IP address or domain name.', example='[
    "1.1.XX.XX",
    "2.2.XX.XX"
]'),
      }
    ](name='BackupBackends', description='An array of HTTPS listener ports.'),
    connectTimeout?: int32(name='ConnectTimeout', description='The timeout period of the connection. Unit: seconds. Valid values: 5 to 120.', example='120'),
    focusHttpBackend?: boolean(name='FocusHttpBackend', description='Indicates whether HTTPS to HTTP redirection is enabled for back-to-origin requests of the domain name. Valid values:

*   **true:** HTTPS to HTTP redirection for back-to-origin requests of the domain name is enabled.
*   **false:** HTTPS to HTTP redirection for back-to-origin requests of the domain name is disabled.', example='true'),
    keepalive?: boolean(name='Keepalive', description='Indicates whether the persistent connection feature is enabled. Valid values:

*   **true:** The persistent connection feature is enabled. This is the default value.
*   **false:** The persistent connection feature is disabled.', example='true'),
    keepaliveRequests?: int32(name='KeepaliveRequests', description='The number of reused persistent connections. Valid values: 60 to 1000.

>  This parameter specifies the number of reused persistent connections when you enable the persistent connection feature.', example='1000'),
    keepaliveTimeout?: int32(name='KeepaliveTimeout', description='The timeout period of persistent connections that are in the Idle state. Valid values: 1 to 60. Default value: 15. Unit: seconds.

>  This parameter specifies the period of time during which a reused persistent connection is allowed to remain in the Idle state before the persistent connection is released.', example='15'),
    loadbalance?: string(name='Loadbalance', description='The load balancing algorithm that is used when WAF forwards requests to the origin server. Valid values:

*   **ip_hash:** the IP hash algorithm.
*   **roundRobin:** the round-robin algorithm.
*   **leastTime:** the least response time algorithm.', example='iphash'),
    readTimeout?: int32(name='ReadTimeout', description='The read timeout period. Unit: seconds. Valid values: 5 to 1800.', example='200'),
    requestHeaders?: [ 
      {
        key?: string(name='Key', description='The custom header field.', example='aaa'),
        value?: string(name='Value', description='The value of the custom header field.', example='bbb'),
      }
    ](name='RequestHeaders', description='An array of key-value pairs that are used to mark the requests that pass through the WAF instance.'),
    retry?: boolean(name='Retry', description='Indicates whether WAF retries when requests fail to be forwarded to the origin server. Valid values:

*   **true:** WAF retries. This is the default value.
*   **false:** WAF does not retry.', example='true'),
    sniEnabled?: boolean(name='SniEnabled', description='Indicates whether origin Server Name Indication (SNI) is enabled. Valid values:

*   **true:** Origin SNI is enabled.
*   **false:** Origin SNI is disabled. This is the default value.', example='true'),
    sniHost?: string(name='SniHost', description='The value of the custom SNI field.', example='www.aliyundoc.com'),
    writeTimeout?: int32(name='WriteTimeout', description='The write timeout period. Unit: seconds. Valid values: 5 to 1800.', example='200'),
    xffProto?: boolean(name='XffProto', description='Indicates whether the X-Forward-For-Proto header is used to identify the protocol used by WAF to forward requests to the origin server. Valid values:

*   **true** (default)
*   **false**', example='true'),
  }(name='Redirect', description='The configurations of the forwarding rule.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='BAEF9CA9-66A0-533E-BD09-5D5D7AA8****'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  SM2CertDetail?: {
    commonName?: string(name='CommonName', description='The domain name of your website.', example='test.aliyundoc.com'),
    endTime?: long(name='EndTime', description='The end of the validity period of the SSL certificate. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1665590400000'),
    id?: string(name='Id', description='The ID of the SSL certificate.', example='123-cn-hangzhou'),
    name?: string(name='Name', description='The name of the SSL certificate.', example='test-sm2-cert-name'),
    sans?: [ string ](name='Sans', description='All domain names that are bound to the certificate.'),
    startTime?: long(name='StartTime', description='The beginning of the validity period of the SSL certificate. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.', example='1657551525000'),
  }(name='SM2CertDetail', description='The information about the SM certificate.'),
  status?: long(name='Status', description='The status of the domain name. Valid values:

*   **1:** The domain name is in a normal state.
*   **2:** The domain name is being created.
*   **3:** The domain name is being modified.
*   **4:** The domain name is being released.
*   **5:** WAF no longer forwards traffic of the domain name.', example='1'),
}

model DescribeDomainDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDomainDetailResponseBody(name='body'),
}

/**
 * @summary Queries the details of a domain name that is added to Web Application Firewall (WAF).
 *
 * @param request DescribeDomainDetailRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDomainDetailResponse
 */
async function describeDomainDetailWithOptions(request: DescribeDomainDetailRequest, runtime: $RuntimeOptions): DescribeDomainDetailResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDomainDetail',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details of a domain name that is added to Web Application Firewall (WAF).
 *
 * @param request DescribeDomainDetailRequest
 * @return DescribeDomainDetailResponse
 */
async function describeDomainDetail(request: DescribeDomainDetailRequest): DescribeDomainDetailResponse {
  var runtime = new $RuntimeOptions{};
  return describeDomainDetailWithOptions(request, runtime);
}

model DescribeDomainsRequest {
  backend?: string(name='Backend', description='An array of HTTPS listener ports.', example='1.1.XX.XX'),
  domain?: string(name='Domain', description='The ID of the request.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='The page number of the page to return. Default value: 1.

This parameter is required.', example='waf_cdnsdf3****'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  tag?: [ 
    {
      key?: string(name='Key', description='The tag key.', example='TagKey1'),
      value?: string(name='Value', description='The tag value.', example='TagValue1'),
    }
  ](name='Tag', description='The tag of the resource. You can specify up to 20 tags.'),
}

model DescribeDomainsResponseBody = {
  domains?: [ 
    {
      backeds?: {
        http?: [ 
          {
            backend?: string(name='Backend', description='The HTTP address of the origin server.', example='1.1.XX.XX'),
          }
        ](name='Http', description='The HTTP addresses of the origin server.'),
        https?: [ 
          {
            backend?: string(name='Backend', description='The HTTPS address of the origin server.', example='1.1.XX.XX'),
          }
        ](name='Https', description='The HTTPS addresses of the origin server.'),
      }(name='Backeds', description='The back-to-origin settings.'),
      cname?: string(name='Cname', description='The CNAME assigned by WAF to the domain name.', example='xxxxxcvdaf.****.com'),
      domain?: string(name='Domain', description='The domain name that is added to WAF in CNAME record mode.', example='www.aliyundoc.com'),
      listenPorts?: {
        http?: [ long ](name='Http', description='The HTTP listener ports.'),
        https?: [ long ](name='Https', description='The HTTPS listener ports.'),
      }(name='ListenPorts', description='The configurations of the listeners.'),
      resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfmvtc5z52****'),
      status?: int32(name='Status', description='The status of the domain name. Valid values:

*   **1:** The domain name is in a normal state.
*   **2:** The domain name is being created.
*   **3:** The domain name is being modified.
*   **4:** The domain name is being released.
*   **5:** WAF no longer forwards traffic that is sent to the domain name.', example='1'),
    }
  ](name='Domains', description='The domain names that are added to WAF in CNAME record mode.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='ABF68BB3-2C48-5FA4-9750-D5FE55700E36'),
  totalCount?: long(name='TotalCount', description='The total number of returned entries.', example='146'),
}

model DescribeDomainsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDomainsResponseBody(name='body'),
}

/**
 * @summary Queries the domain names that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeDomainsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDomainsResponse
 */
async function describeDomainsWithOptions(request: DescribeDomainsRequest, runtime: $RuntimeOptions): DescribeDomainsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.backend)) {
    query['Backend'] = request.backend;
  }
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeDomains',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the domain names that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeDomainsRequest
 * @return DescribeDomainsResponse
 */
async function describeDomains(request: DescribeDomainsRequest): DescribeDomainsResponse {
  var runtime = new $RuntimeOptions{};
  return describeDomainsWithOptions(request, runtime);
}

model DescribeFlowChartRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386280'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  interval?: string(name='Interval', description='The time interval. Unit: seconds. The value must be an integral multiple of 60.

This parameter is required.', example='300'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeFlowChartResponseBody = {
  flowChart?: [ 
    {
      aclCustomBlockSum?: long(name='AclCustomBlockSum', description='The number of requests that are blocked by custom access control list (ACL) rules.', example='0'),
      aclCustomReportsSum?: long(name='AclCustomReportsSum', description='The number of requests that are monitored by custom ACL rules.', example='0'),
      antiScanBlockSum?: long(name='AntiScanBlockSum', description='The number of requests that are blocked by scan protection rules.', example='0'),
      antibotBlockSum?: long(name='AntibotBlockSum', description='The number of requests that are blocked by bot management rules.', example='0'),
      antibotReportSum?: string(name='AntibotReportSum', description='The number of requests that are monitored by bot management rules.', example='0'),
      antiscanReportsSum?: long(name='AntiscanReportsSum', description='The number of requests that are monitored by scan protection rules.', example='0'),
      blacklistBlockSum?: string(name='BlacklistBlockSum', description='The number of requests that are blocked by the IP address blacklist.', example='0'),
      blacklistReportsSum?: long(name='BlacklistReportsSum', description='The number of requests that are monitored by the IP address blacklist.', example='0'),
      ccCustomBlockSum?: long(name='CcCustomBlockSum', description='The number of requests that are blocked by custom HTTP flood protection rules.', example='0'),
      ccCustomReportsSum?: long(name='CcCustomReportsSum', description='The number of requests that are monitored by custom HTTP flood protection rules.', example='0'),
      ccSystemBlocksSum?: long(name='CcSystemBlocksSum', description='The number of requests that are blocked by HTTP flood protection rules created by the system.', example='0'),
      ccSystemReportsSum?: long(name='CcSystemReportsSum', description='The number of requests that are monitored by HTTP flood protection rules created by the system.', example='0'),
      count?: long(name='Count', description='The total number of requests.', example='2932'),
      inBytes?: long(name='InBytes', description='The total number of requests that are redirected to the WAF instance.', example='121645464'),
      index?: long(name='Index', description='The serial number of the time interval. The serial numbers are arranged in chronological order.', example='10'),
      maxPv?: long(name='MaxPv', description='The peak traffic.', example='2932'),
      outBytes?: long(name='OutBytes', description='The total number of requests that are forwarded by the WAF instance.', example='1200540464'),
      ratelimitBlockSum?: long(name='RatelimitBlockSum', description='The number of requests that are blocked by rate limiting rules.', example='0'),
      ratelimitReportSum?: long(name='RatelimitReportSum', description='The number of requests that are monitored by rate limiting rules.', example='0'),
      regionBlockBlocksSum?: long(name='RegionBlockBlocksSum', description='The number of requests that are blocked by region blacklist rules.', example='0'),
      regionBlockReportsSum?: long(name='RegionBlockReportsSum', description='The number of requests that are monitored by region blacklist rules.', example='0'),
      robotCount?: long(name='RobotCount', description='The total number of bot requests.', example='1110'),
      wafBlockSum?: long(name='WafBlockSum', description='The number of requests that are blocked by basic protection rules.', example='0'),
      wafReportSum?: string(name='WafReportSum', description='The number of requests that are monitored by basic protection rules.', example='0'),
    }
  ](name='FlowChart', description='The traffic statistics.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='BFA71416-670E-585D-AAE6-E7BBEE248FAB'),
}

model DescribeFlowChartResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFlowChartResponseBody(name='body'),
}

/**
 * @summary Queries the traffic statistics of requests that are forwarded to Web Application Firewall (WAF).
 *
 * @param request DescribeFlowChartRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFlowChartResponse
 */
async function describeFlowChartWithOptions(request: DescribeFlowChartRequest, runtime: $RuntimeOptions): DescribeFlowChartResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.interval)) {
    query['Interval'] = request.interval;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeFlowChart',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the traffic statistics of requests that are forwarded to Web Application Firewall (WAF).
 *
 * @param request DescribeFlowChartRequest
 * @return DescribeFlowChartResponse
 */
async function describeFlowChart(request: DescribeFlowChartRequest): DescribeFlowChartResponse {
  var runtime = new $RuntimeOptions{};
  return describeFlowChartWithOptions(request, runtime);
}

model DescribeFlowTopResourceRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386340'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeFlowTopResourceResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='8F0E0B9A-B518-5C6D-BEFC-A373DDE4F652'),
  ruleHitsTopResource?: [ 
    {
      count?: long(name='Count', description='The total number of requests received by the protected object in a specified time range.', example='181174784'),
      resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
    }
  ](name='RuleHitsTopResource', description='The array of the top 10 protected objects that receive requests.'),
}

model DescribeFlowTopResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFlowTopResourceResponseBody(name='body'),
}

/**
 * @summary Queries the top 10 protected objects that receive requests.
 *
 * @param request DescribeFlowTopResourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFlowTopResourceResponse
 */
async function describeFlowTopResourceWithOptions(request: DescribeFlowTopResourceRequest, runtime: $RuntimeOptions): DescribeFlowTopResourceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeFlowTopResource',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the top 10 protected objects that receive requests.
 *
 * @param request DescribeFlowTopResourceRequest
 * @return DescribeFlowTopResourceResponse
 */
async function describeFlowTopResource(request: DescribeFlowTopResourceRequest): DescribeFlowTopResourceResponse {
  var runtime = new $RuntimeOptions{};
  return describeFlowTopResourceWithOptions(request, runtime);
}

model DescribeFlowTopUrlRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386340'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeFlowTopUrlResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='520D4E4C-B8EC-5602-ACB6-4D378ACBA28D'),
  ruleHitsTopUrl?: [ 
    {
      count?: long(name='Count', description='The total number of requests that are initiated by using the URL.', example='181174784'),
      url?: string(name='Url', description='The URL that is used to initiate requests.', example='www.aliyundoc.com/path1'),
    }
  ](name='RuleHitsTopUrl', description='The array of the top 10 URLs that are used to initiate requests.'),
}

model DescribeFlowTopUrlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFlowTopUrlResponseBody(name='body'),
}

/**
 * @summary Queries the top 10 URLs that are used to initiate requests.
 *
 * @param request DescribeFlowTopUrlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFlowTopUrlResponse
 */
async function describeFlowTopUrlWithOptions(request: DescribeFlowTopUrlRequest, runtime: $RuntimeOptions): DescribeFlowTopUrlResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeFlowTopUrl',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the top 10 URLs that are used to initiate requests.
 *
 * @param request DescribeFlowTopUrlRequest
 * @return DescribeFlowTopUrlResponse
 */
async function describeFlowTopUrl(request: DescribeFlowTopUrlRequest): DescribeFlowTopUrlResponse {
  var runtime = new $RuntimeOptions{};
  return describeFlowTopUrlWithOptions(request, runtime);
}

model DescribeFreeUserAssetCountRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-cs0*****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeFreeUserAssetCountResponseBody = {
  asset?: {
    assetActive?: long(name='AssetActive', description='The number of active APIs.', example='34'),
    assetCount?: long(name='AssetCount', description='The total number of APIs.', example='15'),
    assetOffline?: long(name='AssetOffline', description='The number of deactivated APIs.', example='13'),
  }(name='Asset', description='The asset statistics provided by basic detection.'),
  requestId?: string(name='RequestId', description='The request ID.', example='30488BF0-FD58-52DD-B396-D014549F43A3'),
}

model DescribeFreeUserAssetCountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFreeUserAssetCountResponseBody(name='body'),
}

/**
 * @summary Queries the asset statistics provided by basic detection in the API security module.
 *
 * @param request DescribeFreeUserAssetCountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFreeUserAssetCountResponse
 */
async function describeFreeUserAssetCountWithOptions(request: DescribeFreeUserAssetCountRequest, runtime: $RuntimeOptions): DescribeFreeUserAssetCountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeFreeUserAssetCount',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the asset statistics provided by basic detection in the API security module.
 *
 * @param request DescribeFreeUserAssetCountRequest
 * @return DescribeFreeUserAssetCountResponse
 */
async function describeFreeUserAssetCount(request: DescribeFreeUserAssetCountRequest): DescribeFreeUserAssetCountResponse {
  var runtime = new $RuntimeOptions{};
  return describeFreeUserAssetCountWithOptions(request, runtime);
}

model DescribeFreeUserEventCountRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepay_public_intl-sg-vf***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeFreeUserEventCountResponseBody = {
  event?: {
    eventHigh?: long(name='EventHigh', description='The number of high-risk events.', example='1'),
    eventLow?: long(name='EventLow', description='The number of low-risk events.', example='12'),
    eventMedium?: long(name='EventMedium', description='The number of medium-risk events.', example='3'),
    eventTotal?: long(name='EventTotal', description='The total number of security events.', example='16'),
  }(name='Event', description='The information about the security events that are detected by using the basic detection feature.'),
  requestId?: string(name='RequestId', description='The request ID.', example='0D9FB3BC-0DE9-58A8-9663-ACE56F24F405'),
}

model DescribeFreeUserEventCountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFreeUserEventCountResponseBody(name='body'),
}

/**
 * @summary Queries the statistics of security events that are detected by using the basic detection feature of the API security module.
 *
 * @param request DescribeFreeUserEventCountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFreeUserEventCountResponse
 */
async function describeFreeUserEventCountWithOptions(request: DescribeFreeUserEventCountRequest, runtime: $RuntimeOptions): DescribeFreeUserEventCountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeFreeUserEventCount',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the statistics of security events that are detected by using the basic detection feature of the API security module.
 *
 * @param request DescribeFreeUserEventCountRequest
 * @return DescribeFreeUserEventCountResponse
 */
async function describeFreeUserEventCount(request: DescribeFreeUserEventCountRequest): DescribeFreeUserEventCountResponse {
  var runtime = new $RuntimeOptions{};
  return describeFreeUserEventCountWithOptions(request, runtime);
}

model DescribeFreeUserEventTypesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-bl0****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeFreeUserEventTypesResponseBody = {
  data?: [ 
    {
      eventNum?: string(name='EventNum', description='The number of security events.', example='4'),
      eventType?: string(name='EventType', description='The type of the security event.', example='SMSInterfaceAbuse'),
    }
  ](name='Data', description='The types of security events on which basic detection is performed.'),
  requestId?: string(name='RequestId', description='The request ID.', example='B9D6AD11-DD3D-5A27-B1D9-8A37F7777196'),
}

model DescribeFreeUserEventTypesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFreeUserEventTypesResponseBody(name='body'),
}

/**
 * @summary Queries the types of security events on which basic detection is performed in the API security module.
 *
 * @param request DescribeFreeUserEventTypesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFreeUserEventTypesResponse
 */
async function describeFreeUserEventTypesWithOptions(request: DescribeFreeUserEventTypesRequest, runtime: $RuntimeOptions): DescribeFreeUserEventTypesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeFreeUserEventTypes',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the types of security events on which basic detection is performed in the API security module.
 *
 * @param request DescribeFreeUserEventTypesRequest
 * @return DescribeFreeUserEventTypesResponse
 */
async function describeFreeUserEventTypes(request: DescribeFreeUserEventTypesRequest): DescribeFreeUserEventTypesResponse {
  var runtime = new $RuntimeOptions{};
  return describeFreeUserEventTypesWithOptions(request, runtime);
}

model DescribeFreeUserEventsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-27a3****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeFreeUserEventsResponseBody = {
  event?: [ 
    {
      apiFormat?: string(name='ApiFormat', description='The API.', example='/api/login'),
      attackIP?: string(name='AttackIP', description='The attacker IP address.', example='104.234.140.**'),
      attackTime?: long(name='AttackTime', description='The time at which the attack was launched. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1683703260'),
      domain?: string(name='Domain', description='The domain name of the API.', example='www.***.cn'),
      eventLevel?: string(name='EventLevel', description='The severity level of the security event. Valid values:

*   **high**
*   **medium**
*   **low**', example='high'),
      eventTag?: string(name='EventTag', description='The type of the security event.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of security events.', example='Event_DataTraverse'),
    }
  ](name='Event', description='The security events on which basic detection is performed.'),
  requestId?: string(name='RequestId', description='The request ID.', example='8A2DF88D-90C2-56E9-B8D5-36BB9646791C'),
}

model DescribeFreeUserEventsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFreeUserEventsResponseBody(name='body'),
}

/**
 * @summary Queries the list of security events on which basic detection is performed in the API security module.
 *
 * @param request DescribeFreeUserEventsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFreeUserEventsResponse
 */
async function describeFreeUserEventsWithOptions(request: DescribeFreeUserEventsRequest, runtime: $RuntimeOptions): DescribeFreeUserEventsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeFreeUserEvents',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the list of security events on which basic detection is performed in the API security module.
 *
 * @param request DescribeFreeUserEventsRequest
 * @return DescribeFreeUserEventsResponse
 */
async function describeFreeUserEvents(request: DescribeFreeUserEventsRequest): DescribeFreeUserEventsResponse {
  var runtime = new $RuntimeOptions{};
  return describeFreeUserEventsWithOptions(request, runtime);
}

model DescribeHybridCloudClusterRuleRequest {
  clusterId?: long(name='ClusterId', description='The ID of the hybrid cloud cluster.

This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-uqm33n***02'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid value:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  ruleType?: string(name='RuleType', description='The type of the rule. Valid values:

*   **pullin**: The traffic redirection rule of the hybrid cloud cluster.

This parameter is required.', example='pullin'),
}

model DescribeHybridCloudClusterRuleResponseBody = {
  clusterRule?: {
    ruleConfig?: string(name='RuleConfig', description='The configuration of the rule.', example='{\\\\"check_mode\\\\":\\\\"all\\\\",\\\\"exclude\\\\":{\\\\"exact\\\\":[],\\\\"regex\\\\":[]}}'),
    ruleStatus?: string(name='RuleStatus', description='The status of the rule. Valid values:

*   **on**: enabled.
*   **off**: disabled.', example='on'),
    ruleType?: string(name='RuleType', description='The type of the rule. Valid values:

*   **pullin**: The traffic redirection rule of the hybrid cloud cluster.', example='pullin'),
  }(name='ClusterRule', description='The details of the rule.'),
  requestId?: string(name='RequestId', description='The request ID.', example='1F29A6D2-9EB6-526D-A997-36888**99CB'),
}

model DescribeHybridCloudClusterRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHybridCloudClusterRuleResponseBody(name='body'),
}

/**
 * @summary Obtains the rule information about a hybrid cloud cluster.
 *
 * @param request DescribeHybridCloudClusterRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHybridCloudClusterRuleResponse
 */
async function describeHybridCloudClusterRuleWithOptions(request: DescribeHybridCloudClusterRuleRequest, runtime: $RuntimeOptions): DescribeHybridCloudClusterRuleResponse {
  request.validate();
  var query = OpenApiUtil.query(request.toMap());
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeHybridCloudClusterRule',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains the rule information about a hybrid cloud cluster.
 *
 * @param request DescribeHybridCloudClusterRuleRequest
 * @return DescribeHybridCloudClusterRuleResponse
 */
async function describeHybridCloudClusterRule(request: DescribeHybridCloudClusterRuleRequest): DescribeHybridCloudClusterRuleResponse {
  var runtime = new $RuntimeOptions{};
  return describeHybridCloudClusterRuleWithOptions(request, runtime);
}

model DescribeHybridCloudClustersRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-uqm35****02'),
  regionId?: string(name='RegionId', description='The region where the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeHybridCloudClustersResponseBody = {
  clusterInfos?: [ 
    {
      accessMode?: string(name='AccessMode', description='The network access mode. Valid values:

*   **internet**: Internet access.
*   **vpc**: internal network access by using Express Connect circuits.', example='internet'),
      accessRegion?: string(name='AccessRegion', description='The region where the virtual private cloud (VPC) resides. Valid values:

*   **cn-hangzhou**: China (Hangzhou).
*   **cn-beiijng**: China (Beijing).
*   **cn-shanghai**: China (Shanghai).', example='cn-hangzhou'),
      clusterName?: string(name='ClusterName', description='The name of the cluster.', example='test'),
      clusterResourceId?: string(name='ClusterResourceId', description='The ID of the hybrid cloud cluster resource.', example='hdbc-cluster-t1****a'),
      httpPorts?: string(name='HttpPorts', description='The HTTP ports. The value is a string. If multiple ports are returned, the value is in the **port1,port2,port3** format.', example='80,8080'),
      httpsPorts?: string(name='HttpsPorts', description='The HTTPS ports. The value is a string. If multiple ports are returned, the value is in the **port1,port2,port3** format.', example='443,8443'),
      id?: long(name='Id', description='The ID of the cluster.', example='524**8'),
      protectionServerCount?: int32(name='ProtectionServerCount', description='The number of protection nodes that can be added to the cluster.', example='1'),
      proxyStatus?: string(name='ProxyStatus', description='The status of the proxy gateway. Valid values:

*   **on**: enabled.
*   **off**: disabled.', example='off'),
      proxyType?: string(name='ProxyType', description='The type of the cluster. Valid values:

*   **cname**: reverse proxy cluster.
*   **service**: SDK-based traffic mirroring cluster.', example='cname'),
      remark?: string(name='Remark', description='The remarks about the cluster.', example='demo'),
      ruleConfig?: string(name='RuleConfig', description='The configurations of the rule.', example='{"enable":true,"param":{"breaker":{"duration":1,"failed":1,"recent_failed":1},"disable_protect":false,"max_request_body_len":1,"timeout":1}}'),
      ruleStatus?: string(name='RuleStatus', description='The status of manual bypass. Valid values:

*   **on**: enabled.
*   **off**: disabled.', example='off'),
      ruleType?: string(name='RuleType', description='The type of the rule. Valid value:

*   **bypass**: Requests are allowed without security checks.', example='bypass'),
    }
  ](name='ClusterInfos', description='The information about the clusters.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='66A98669-ER12-WE34-23PO-301469*****E'),
}

model DescribeHybridCloudClustersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHybridCloudClustersResponseBody(name='body'),
}

/**
 * @summary Queries a list of hybrid cloud clusters.
 *
 * @param request DescribeHybridCloudClustersRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHybridCloudClustersResponse
 */
async function describeHybridCloudClustersWithOptions(request: DescribeHybridCloudClustersRequest, runtime: $RuntimeOptions): DescribeHybridCloudClustersResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeHybridCloudClusters',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of hybrid cloud clusters.
 *
 * @param request DescribeHybridCloudClustersRequest
 * @return DescribeHybridCloudClustersResponse
 */
async function describeHybridCloudClusters(request: DescribeHybridCloudClustersRequest): DescribeHybridCloudClustersResponse {
  var runtime = new $RuntimeOptions{};
  return describeHybridCloudClustersWithOptions(request, runtime);
}

model DescribeHybridCloudGroupsRequest {
  clusterId?: long(name='ClusterId', description='The ID of the hybrid cloud cluster.', example='428'),
  clusterProxyType?: string(name='ClusterProxyType', description='The type of proxy cluster that is used. Valid values:

*   **service**: service-based traffic mirroring.
*   **cname**: reverse proxy.', example='cname'),
  groupName?: int32(name='GroupName', description='The name of the node group that you want to query.', example='groupName1'),
  groupType?: string(name='GroupType', description='The type of the node group. Valid values:

*   **protect**
*   **control**
*   **storage**
*   **controlStorage**', example='protect'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-********w0b'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
}

model DescribeHybridCloudGroupsResponseBody = {
  groups?: [ 
    {
      backSourceMark?: string(name='BackSourceMark', description='The back-to-origin mark of the protected cluster. The value is in the {ISP name}-{Continent name}-{City name}-{Back-to-origin identifier} format. The back-to-origin identifier is optional.

>  For more information about ISP names, continent names, city names, and back-to-origin identifiers, see the following sections.', example='aliyun-asiapacific-beijing-12345678'),
      continentsValue?: int32(name='ContinentsValue', description='The continent code of the protected cluster.

>  For more information about continent codes, see Continent codes in this topic.', example='410'),
      groupId?: int32(name='GroupId', description='The ID of the node group.', example='123'),
      groupName?: string(name='GroupName', description='The name of the node group.', example='StorageGroup'),
      groupType?: string(name='GroupType', description='The type of the node group. Valid values:

*   **protect**
*   **control**
*   **storage**
*   **controlStorage**', example='protect'),
      loadBalanceIp?: string(name='LoadBalanceIp', description='The IP address of the server used for load balancing.', example='1.1.XX.XX'),
      locationId?: long(name='LocationId', description='The ID of the protection node.', example='1312'),
      operatorValue?: int32(name='OperatorValue', description='The ISP code of the protected cluster.

>  For more information about ISP codes, see ISP codes in this topic.', example='0'),
      ports?: string(name='Ports', description='The port that is used by the hybrid cloud cluster. The value of this parameter is a string. If multiple ports are returned, the value is in the **port1,port2,port3** format.', example='80,9200,20018'),
      regionCodeValue?: int32(name='RegionCodeValue', description='The city code of the protected cluster.

>  For more information about city codes, see City codes in this topic.', example='0'),
      remark?: string(name='Remark', description='The description of the node group.', example='test'),
    }
  ](name='Groups', description='The node groups.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='045660E7-C4C6-5CD7-8182-7B337D95****'),
  totalCount?: int32(name='TotalCount', description='The total number of entries returned.', example='146'),
}

model DescribeHybridCloudGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHybridCloudGroupsResponseBody(name='body'),
}

/**
 * @summary Queries the hybrid cloud node groups that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeHybridCloudGroupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHybridCloudGroupsResponse
 */
async function describeHybridCloudGroupsWithOptions(request: DescribeHybridCloudGroupsRequest, runtime: $RuntimeOptions): DescribeHybridCloudGroupsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.clusterProxyType)) {
    query['ClusterProxyType'] = request.clusterProxyType;
  }
  if (!$isNull(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!$isNull(request.groupType)) {
    query['GroupType'] = request.groupType;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeHybridCloudGroups',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the hybrid cloud node groups that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeHybridCloudGroupsRequest
 * @return DescribeHybridCloudGroupsResponse
 */
async function describeHybridCloudGroups(request: DescribeHybridCloudGroupsRequest): DescribeHybridCloudGroupsResponse {
  var runtime = new $RuntimeOptions{};
  return describeHybridCloudGroupsWithOptions(request, runtime);
}

model DescribeHybridCloudResourcesRequest {
  backend?: string(name='Backend', description='The back-to-origin IP address or domain name.', example='1.1.XX.XX'),
  cnameEnabled?: boolean(name='CnameEnabled', description='Specifies whether the public cloud disaster recovery feature is enabled for the domain name. Valid values:

*   **true**
*   **false**', example='true'),
  domain?: string(name='Domain', description='The domain name that you want to query.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-***********'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfmvtc5z52****'),
}

model DescribeHybridCloudResourcesResponseBody = {
  domains?: [ 
    {
      cname?: string(name='Cname', description='The CNAME assigned by WAF.

>  This parameter is returned only if the value of **CnameEnabled** is true.', example='50fqmu1ci7g0xtiyxnrhgx6qdhmn****.yundunwaf5.com'),
      domain?: string(name='Domain', description='The domain name.', example='www.aliyundoc.com'),
      id?: long(name='Id', description='The access ID.', example='1'),
      listen?: {
        certId?: string(name='CertId', description='The ID of the certificate.', example='72***76-cn-hangzhou'),
        cipherSuite?: int32(name='CipherSuite', description='The types of cipher suites that are added. Valid values:

*   **1:** all cipher suites.
*   **2:** strong cipher suites.
*   **99:** custom cipher suites.', example='1'),
        customCiphers?: [ string ](name='CustomCiphers', description='The custom cipher suites.

>  This parameter is returned only if the value of **CipherSuite** is **99**.'),
        enableTLSv3?: boolean(name='EnableTLSv3', description='Indicates whether TLS 1.3 is supported. Valid values:

*   **true**
*   **false**', example='true'),
        exclusiveIp?: boolean(name='ExclusiveIp', description='Indicates whether exclusive IP addresses are supported. Valid values:

*   **true**
*   **false**', example='true'),
        focusHttps?: boolean(name='FocusHttps', description='Indicates whether the HTTP to HTTPS redirection feature is enabled for the domain name. Valid values:

*   **true**
*   **false**', example='false'),
        http2Enabled?: boolean(name='Http2Enabled', description='Indicates whether HTTP/2 is enabled. Valid values:

*   **true**
*   **false**', example='false'),
        httpPorts?: [ long ](name='HttpPorts', description='The HTTP listener ports.'),
        httpsPorts?: [ long ](name='HttpsPorts', description='The HTTPS listener ports.'),
        IPv6Enabled?: boolean(name='IPv6Enabled', description='Specifies whether to enable IPv6. Valid values:

*   **true**
*   **false**', example='false'),
        protectionResource?: string(name='ProtectionResource', description='The type of the protection resource. Valid values:

*   **share:** shared cluster.
*   **gslb:** shared cluster-based intelligent load balancing.', example='share'),
        TLSVersion?: string(name='TLSVersion', description='The version of the Transport Layer Security (TLS) protocol. Valid values:

*   **tlsv1**
*   **tlsv1.1**
*   **tlsv1.2**', example='tlsv1.2'),
        xffHeaderMode?: int32(name='XffHeaderMode', description='The method that is used to obtain the actual IP address of a client. Valid values:

*   **0**: No Layer 7 proxies are deployed in front of WAF.
*   **1**: WAF reads the first value of the X-Forwarded-For (XFF) header field as the actual IP address of the client.
*   **2**: WAF reads the value of a custom header field as the actual IP address of the client.', example='0'),
        xffHeaders?: [ string ](name='XffHeaders', description='The custom header fields that are used to obtain the actual IP addresses of clients. The value is in the ["header1","header2",...] format.

>  This parameter is returned only if the value of **XffHeaderMode** is 2.'),
      }(name='Listen', description='The listeners.'),
      redirect?: {
        backends?: [ string ](name='Backends', description='The IP addresses or domain names of the origin server.'),
        cnameEnabled?: boolean(name='CnameEnabled', description='Indicates whether the public cloud disaster recovery feature is enabled. Valid values:

*   **true**
*   **false**', example='true'),
        connectTimeout?: long(name='ConnectTimeout', description='The timeout period for connections. Unit: seconds. Valid values: 5 to 120.', example='120'),
        focusHttpBackend?: boolean(name='FocusHttpBackend', description='Indicates whether the HTTPS to HTTP redirection feature is enabled for back-to-origin requests. Valid values:

*   **true**
*   **false**', example='true'),
        keepalive?: boolean(name='Keepalive', description='Indicates whether the persistent connection feature is enabled. Valid values:

*   **true**
*   **false**', example='true'),
        keepaliveRequests?: long(name='KeepaliveRequests', description='The number of reused persistent connections. Valid values: 60 to 1000.

>  This parameter indicates the number of reused persistent connections after the persistent connection feature is enabled.', example='1000'),
        keepaliveTimeout?: long(name='KeepaliveTimeout', description='The timeout period for persistent connections that are in the Idle state. Unit: seconds. Valid values: 1 to 60. Default value: 15.

>  This parameter indicates the period of time during which a reused persistent connection can remain in the Idle state before the persistent connection is released.', example='15'),
        loadbalance?: string(name='Loadbalance', description='The load balancing algorithm that is used to forward requests to the origin server. Valid values:

*   **iphash**
*   **roundRobin**
*   **leastTime**', example='iphash'),
        readTimeout?: long(name='ReadTimeout', description='The timeout period for read connections. Unit: seconds. Valid values: 5 to 1800.', example='200'),
        requestHeaders?: [ 
          {
            key?: string(name='Key', description='The key of the custom header field.', example='aaa'),
            value?: string(name='Value', description='The value of the custom header field.', example='bbb'),
          }
        ](name='RequestHeaders', description='The key-value pair that is used to label requests that pass through WAF.'),
        retry?: boolean(name='Retry', description='Indicates whether WAF retries forwarding requests if requests fail to be forwarded to the origin server. Valid values:

*   **true**
*   **false**', example='true'),
        routingRules?: string(name='RoutingRules', description='The forwarding rules that are configured for the domain name. This parameter is a string that consists of JSON arrays. Each element in a JSON array is a JSON struct that contains the following fields:

*   **rs**: the back-to-origin IP addresses or CNAMEs. The value is of the ARRAY type.
*   **location**: the name of the protection node. The value is of the STRING type.
*   **locationId**: the ID of the protection node. The value is of the LONG type.', example='[
      {
            "rs": [
                  "1.1.XX.XX"
            ],
            "locationId": 535,
            "location": "test1111"
      }
]'),
        sniEnabled?: boolean(name='SniEnabled', description='Indicates whether the origin Server Name Indication (SNI) feature is enabled. Valid values:

*   **true**
*   **false**', example='true'),
        sniHost?: string(name='SniHost', description='The value of the custom SNI field. If the parameter is left empty, the value of the **Host** field in the request header is automatically used as the value of the SNI field.

>  This parameter is returned only if the value of **SniEnabled** is **true**.', example='www.aliyundoc.com'),
        writeTimeout?: long(name='WriteTimeout', description='The timeout period for write connections. Unit: seconds. Valid values: 5 to 1800.', example='200'),
      }(name='Redirect', description='The configurations of the forwarding rule.'),
      resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfmvtc5z52****'),
      status?: int32(name='Status', description='The status of the domain name. Valid values:

*   **1:** The domain name is in a normal state.
*   **2:** The domain name is being created.
*   **3:** The domain name is being modified.
*   **4:** The domain name is being released.
*   **5:** WAF no longer forwards the traffic of the domain name.', example='1'),
      uid?: string(name='Uid', description='The user ID.', example='130715431409****'),
    }
  ](name='Domains', description='The domain names.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='98D2AA9A-5959-5CCD-83E3-B6606232A2BE'),
  totalCount?: long(name='TotalCount', description='The total number of entries that are returned.', example='24'),
}

model DescribeHybridCloudResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHybridCloudResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the domain names that are added to a Web Application Firewall (WAF) instance in hybrid cloud mode.
 *
 * @param request DescribeHybridCloudResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHybridCloudResourcesResponse
 */
async function describeHybridCloudResourcesWithOptions(request: DescribeHybridCloudResourcesRequest, runtime: $RuntimeOptions): DescribeHybridCloudResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.backend)) {
    query['Backend'] = request.backend;
  }
  if (!$isNull(request.cnameEnabled)) {
    query['CnameEnabled'] = request.cnameEnabled;
  }
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeHybridCloudResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the domain names that are added to a Web Application Firewall (WAF) instance in hybrid cloud mode.
 *
 * @param request DescribeHybridCloudResourcesRequest
 * @return DescribeHybridCloudResourcesResponse
 */
async function describeHybridCloudResources(request: DescribeHybridCloudResourcesRequest): DescribeHybridCloudResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return describeHybridCloudResourcesWithOptions(request, runtime);
}

model DescribeHybridCloudServerRegionsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-5yd****7009'),
  regionCode?: string(name='RegionCode', description='The code of the region.

>  This parameter is required if you set RegionType to region. The value is the code of the city.', example='410'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  regionType?: string(name='RegionType', description='The type of the region. Valid values:

*   **operator**: the ISP.
*   **continents**: the continent.
*   **region**: the city.

This parameter is required.', example='region'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeHybridCloudServerRegionsResponseBody = {
  regions?: [ 
    {
      code?: int32(name='Code', description='The code of the region.', example='1'),
      name?: string(name='Name', description='The name of the region.', example='aliyun'),
    }
  ](name='Regions', description='The information about the regions.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='0FBBDE11-C35F-531B-96BA-64CA****C875'),
}

model DescribeHybridCloudServerRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHybridCloudServerRegionsResponseBody(name='body'),
}

/**
 * @summary Queries information about the regions that the hybrid cloud mode supports, such as the Internet service providers (ISPs), continents, and cities.
 *
 * @param request DescribeHybridCloudServerRegionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHybridCloudServerRegionsResponse
 */
async function describeHybridCloudServerRegionsWithOptions(request: DescribeHybridCloudServerRegionsRequest, runtime: $RuntimeOptions): DescribeHybridCloudServerRegionsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.regionType)) {
    query['RegionType'] = request.regionType;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeHybridCloudServerRegions',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries information about the regions that the hybrid cloud mode supports, such as the Internet service providers (ISPs), continents, and cities.
 *
 * @param request DescribeHybridCloudServerRegionsRequest
 * @return DescribeHybridCloudServerRegionsResponse
 */
async function describeHybridCloudServerRegions(request: DescribeHybridCloudServerRegionsRequest): DescribeHybridCloudServerRegionsResponse {
  var runtime = new $RuntimeOptions{};
  return describeHybridCloudServerRegionsWithOptions(request, runtime);
}

model DescribeHybridCloudUnassignedMachinesRequest {
  clusterId?: int32(name='ClusterId', description='The ID of the hybrid cloud cluster.

This parameter is required.', example='123'),
  hostName?: string(name='HostName', description='The host name.', example='online-xagent1'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-5yd****7009'),
  ip?: string(name='Ip', description='The IP address of the server.', example='1.X.X.1'),
  pageNumber?: int32(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeHybridCloudUnassignedMachinesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='3EBCFCE9-4A3C-5E01-915D-691B****510A'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='28'),
  unassignedMachines?: [ 
    {
      cpu?: long(name='Cpu', description='The number of CPU cores.', example='16'),
      customName?: string(name='CustomName', description='The name of the node.', example='exampleName'),
      hostName?: string(name='HostName', description='The host name.', example='online-xagent1'),
      ip?: string(name='Ip', description='The IP address of the server.', example='1.X.X.1'),
      mac?: string(name='Mac', description='The media access control (MAC) address of the device.', example='00163e2686ac'),
      memory?: long(name='Memory', description='The memory size. Unit: KB. A conversion factor of 1,000 is used.', example='31580872'),
      mid?: string(name='Mid', description='The ID of the node.', example='78db009ab6cf055a9085f9f4****ae3a'),
    }
  ](name='UnassignedMachines', description='The servers that are not assigned to the hybrid cloud cluster.'),
}

model DescribeHybridCloudUnassignedMachinesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHybridCloudUnassignedMachinesResponseBody(name='body'),
}

/**
 * @summary Queries servers that are not assigned to a hybrid cloud cluster.
 *
 * @param request DescribeHybridCloudUnassignedMachinesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHybridCloudUnassignedMachinesResponse
 */
async function describeHybridCloudUnassignedMachinesWithOptions(request: DescribeHybridCloudUnassignedMachinesRequest, runtime: $RuntimeOptions): DescribeHybridCloudUnassignedMachinesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.hostName)) {
    query['HostName'] = request.hostName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.ip)) {
    query['Ip'] = request.ip;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeHybridCloudUnassignedMachines',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries servers that are not assigned to a hybrid cloud cluster.
 *
 * @param request DescribeHybridCloudUnassignedMachinesRequest
 * @return DescribeHybridCloudUnassignedMachinesResponse
 */
async function describeHybridCloudUnassignedMachines(request: DescribeHybridCloudUnassignedMachinesRequest): DescribeHybridCloudUnassignedMachinesResponse {
  var runtime = new $RuntimeOptions{};
  return describeHybridCloudUnassignedMachinesWithOptions(request, runtime);
}

model DescribeHybridCloudUserRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-***********'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
}

model DescribeHybridCloudUserResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9178CB86-285F-5679-A30A-3B3F007E4206'),
  userInfo?: {
    httpPorts?: string(name='HttpPorts', description='The HTTP ports. The value is a string. If multiple ports are returned, the value is in the **port1,port2,port3** format.', example='80,8080'),
    httpsPorts?: string(name='HttpsPorts', description='The HTTPS ports. The value is a string. If multiple ports are returned, the value is in the **port1,port2,port3** format.', example='8443,443'),
  }(name='UserInfo', description='The information about the ports that can be used by a hybrid cloud cluster.'),
}

model DescribeHybridCloudUserResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeHybridCloudUserResponseBody(name='body'),
}

/**
 * @summary Queries the HTTP and HTTPS ports that you can use when you add a domain name to Web Application Firewall (WAF) in hybrid cloud mode.
 *
 * @param request DescribeHybridCloudUserRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeHybridCloudUserResponse
 */
async function describeHybridCloudUserWithOptions(request: DescribeHybridCloudUserRequest, runtime: $RuntimeOptions): DescribeHybridCloudUserResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeHybridCloudUser',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the HTTP and HTTPS ports that you can use when you add a domain name to Web Application Firewall (WAF) in hybrid cloud mode.
 *
 * @param request DescribeHybridCloudUserRequest
 * @return DescribeHybridCloudUserResponse
 */
async function describeHybridCloudUser(request: DescribeHybridCloudUserRequest): DescribeHybridCloudUserResponse {
  var runtime = new $RuntimeOptions{};
  return describeHybridCloudUserWithOptions(request, runtime);
}

model DescribeInstanceRequest {
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
}

model DescribeInstanceResponseBody = {
  details?: {
    aclRuleMaxIpCount?: long(name='AclRuleMaxIpCount', description='The maximum number of IP addresses that can be added to the match content of a match condition. For more information, see [Match conditions](https://help.aliyun.com/document_detail/374354.html).', example='100'),
    antiScan?: boolean(name='AntiScan', description='Indicates whether the scan protection module is supported. Valid values:

*   **true:** The scan protection module is supported.
*   **false:** The scan protection module is not supported.', example='true'),
    antiScanTemplateMaxCount?: long(name='AntiScanTemplateMaxCount', description='The maximum number of scan protection rule templates that can be configured.', example='20'),
    backendMaxCount?: long(name='BackendMaxCount', description='The maximum number of back-to-origin IP addresses that can be configured.', example='20'),
    baseWafGroup?: boolean(name='BaseWafGroup', description='Indicates whether the basic protection rule module is supported. Valid values:

*   **true:** The basic protection rule module is supported.
*   **false:** The basic protection rule module is not supported.', example='true'),
    baseWafGroupRuleInTemplateMaxCount?: long(name='BaseWafGroupRuleInTemplateMaxCount', description='The maximum number of protection rules that can be included in a basic protection rule template.', example='100'),
    baseWafGroupRuleTemplateMaxCount?: long(name='BaseWafGroupRuleTemplateMaxCount', description='The maximum number of basic protection rule templates that can be configured.', example='20'),
    bot?: boolean(name='Bot', description='Indicates whether the bot management module is supported. Valid values:

*   **true:** The bot management module is supported.
*   **false:** The bot management module is not supported.', example='true'),
    botApp?: string(name='BotApp', description='Indicates whether bot management for app protection is supported. Valid values:

*   **true:** Bot management for app protection is supported.
*   **false:** Bot management for app protection is not supported.', example='true'),
    botTemplateMaxCount?: long(name='BotTemplateMaxCount', description='The maximum number of bot management rule templates that can be configured.', example='50'),
    botWeb?: string(name='BotWeb', description='Indicates whether bot management for website protection is supported. Valid values:

*   **true:** Bot management for website protection is supported.
*   **false:** Bot management for website protection is not supported.', example='true'),
    cnameResourceMaxCount?: long(name='CnameResourceMaxCount', description='The maximum number of CNAMEs that can be added.', example='1000'),
    customResponse?: boolean(name='CustomResponse', description='Indicates whether the custom response module is supported. Valid values:

*   **true:** The custom response module is supported.
*   **false:** The custom response module is not supported.', example='true'),
    customResponseRuleInTemplateMaxCount?: long(name='CustomResponseRuleInTemplateMaxCount', description='The maximum number of rules that can be included in a custom response rule template.', example='100'),
    customResponseTemplateMaxCount?: long(name='CustomResponseTemplateMaxCount', description='The maximum number of custom response rule templates that can be configured.', example='20'),
    customRule?: boolean(name='CustomRule', description='Indicates whether the custom rule module is supported. Valid values:

*   **true:** The custom rule module is supported.
*   **false:** The custom rule module is not supported.', example='true'),
    customRuleAction?: string(name='CustomRuleAction', description='The action that can be included in a custom rule.', example='block'),
    customRuleCondition?: string(name='CustomRuleCondition', description='The match conditions that can be used in a custom rule. For more information, see **Match condition parameters** in the "**Parameters of custom rules (custom_acl)**" section in the [CreateDefenseRule](~~CreateDefenseRule~~) topic.', example='URL'),
    customRuleInTemplateMaxCount?: long(name='CustomRuleInTemplateMaxCount', description='The maximum number of rules that can be included in a custom rule template.', example='100'),
    customRuleRatelimitor?: string(name='CustomRuleRatelimitor', description='The statistical object for rate limiting in a custom rule.', example='header'),
    customRuleTemplateMaxCount?: long(name='CustomRuleTemplateMaxCount', description='The maximum number of custom rule templates that can be configured.', example='20'),
    defenseGroupMaxCount?: long(name='DefenseGroupMaxCount', description='The maximum number of protected object groups that can be configured.', example='100'),
    defenseObjectInGroupMaxCount?: long(name='DefenseObjectInGroupMaxCount', description='The maximum number of protected objects that can be included in a protected object group.', example='100'),
    defenseObjectInTemplateMaxCount?: long(name='DefenseObjectInTemplateMaxCount', description='The maximum number of protected objects to which a protection rule template can be applied.', example='100'),
    defenseObjectMaxCount?: long(name='DefenseObjectMaxCount', description='The maximum number of protected objects that can be configured.', example='20,000'),
    dlp?: boolean(name='Dlp', description='Indicates whether the data leakage prevention module is supported. Valid values:

*   **true:** The data leakage prevention module is supported.
*   **false:** The data leakage prevention module is not supported.', example='true'),
    dlpRuleInTemplateMaxCount?: long(name='DlpRuleInTemplateMaxCount', description='The maximum number of rules that can be included in a data leakage prevention rule template.', example='50'),
    dlpTemplateMaxCount?: long(name='DlpTemplateMaxCount', description='The maximum number of data leakage prevention rule templates that can be configured.', example='50'),
    exclusiveIp?: boolean(name='ExclusiveIp', description='Indicates whether exclusive IP addresses are supported. Valid values:

*   **true:** Exclusive IP addresses are supported.
*   **false:** Exclusive IP addresses are not supported.', example='true'),
    gslb?: boolean(name='Gslb', description='Indicates whether global server load balancing (GSLB) is supported. Valid values:

*   **true:** GSLB is supported.
*   **false:** GSLB is not supported.', example='true'),
    httpPorts?: string(name='HttpPorts', description='The HTTP port range that is supported. For more information, see [View supported ports](https://help.aliyun.com/document_detail/385578.html).', example='80'),
    httpsPorts?: string(name='HttpsPorts', description='The HTTPS port range that is supported. For more information, see [View supported ports](https://help.aliyun.com/document_detail/385578.html).', example='443'),
    ipBlacklist?: boolean(name='IpBlacklist', description='Indicates whether the IP address blacklist module is supported. Valid values:

*   **true:** The IP address blacklist module is supported.
*   **false:** The IP address blacklist module is not supported.', example='true'),
    ipBlacklistIpInRuleMaxCount?: long(name='IpBlacklistIpInRuleMaxCount', description='The maximum number of IP addresses that can be added to an IP address blacklist rule.', example='200'),
    ipBlacklistRuleInTemplateMaxCount?: long(name='IpBlacklistRuleInTemplateMaxCount', description='The maximum number of rules that can be included in an IP address blacklist rule template.', example='100'),
    ipBlacklistTemplateMaxCount?: long(name='IpBlacklistTemplateMaxCount', description='The maximum number of IP address blacklist rule templates that can be configured.', example='20'),
    ipv6?: boolean(name='Ipv6', description='Indicates whether IPv6 is supported. Valid values:

*   **true:** IPv6 is supported.
*   **false:** IPv6 is not supported.', example='true'),
    logService?: boolean(name='LogService', description='Indicates whether the log collection feature is supported. Valid values:

*   **true:** The log collection feature is supported.
*   **false:** The log collection feature is not supported.', example='true'),
    majorProtection?: boolean(name='MajorProtection', description='Indicates whether major event protection is supported. Valid values:

*   **true:** Major event protection is supported.
*   **false:** Major event protection is not supported.', example='true'),
    majorProtectionTemplateMaxCount?: long(name='MajorProtectionTemplateMaxCount', description='The maximum number of major event protection rule templates that can be configured.', example='20'),
    tamperproof?: boolean(name='Tamperproof', description='Indicates whether the website tamper-proofing module is supported. Valid values:

*   **true:** The website tamper-proofing module is supported.
*   **false:** The website tamper-proofing module is not supported.', example='true'),
    tamperproofRuleInTemplateMaxCount?: long(name='TamperproofRuleInTemplateMaxCount', description='The maximum number of rules that can be included in a website tamper-proofing rule template.', example='50'),
    tamperproofTemplateMaxCount?: long(name='TamperproofTemplateMaxCount', description='The maximum number of website tamper-proofing rule templates that can be configured.', example='50'),
    vastIpBlacklistInFileMaxCount?: long(name='VastIpBlacklistInFileMaxCount', description='The maximum number of IP addresses or CIDR blocks that can be added to an IP address blacklist in a batch.', example='2,000'),
    vastIpBlacklistInOperationMaxCount?: long(name='VastIpBlacklistInOperationMaxCount', description='The maximum number of IP addresses or CIDR blocks that can be added to an IP address blacklist on a page.', example='500'),
    vastIpBlacklistMaxCount?: long(name='VastIpBlacklistMaxCount', description='The maximum number of IP addresses or CIDR blocks that can be added to an IP address blacklist per Alibaba Cloud account.', example='50,000'),
    whitelist?: boolean(name='Whitelist', description='Indicates whether the whitelist module is supported. Valid values:

*   **true:** The whitelist module is supported.
*   **false:** The whitelist module is not supported.', example='true'),
    whitelistLogical?: string(name='WhitelistLogical', description='The logical operators that can be used in a whitelist rule. For more information, see **Match condition parameters** in the "**Parameters of whitelist rules (whitelist)**" section in the [CreateDefenseRule](~~CreateDefenseRule~~) topic.', example='contain'),
    whitelistRuleCondition?: string(name='WhitelistRuleCondition', description='The match fields that can be used in a whitelist rule. For more information, see **Match condition parameters** in the "**Parameters of whitelist rules (whitelist)**" section in the [CreateDefenseRule](~~CreateDefenseRule~~) topic.', example='URL'),
    whitelistRuleInTemplateMaxCount?: long(name='WhitelistRuleInTemplateMaxCount', description='The maximum number of rules that can be included in a whitelist rule template.', example='100'),
    whitelistTemplateMaxCount?: long(name='WhitelistTemplateMaxCount', description='The maximum number of whitelist rule templates that can be configured.', example='20'),
  }(name='Details', description='The details of the WAF instance.'),
  edition?: string(name='Edition', description='The edition of the WAF instance.', example='default_version'),
  endTime?: long(name='EndTime', description='The expiration time of the WAF instance.', example='4809859200000'),
  inDebt?: string(name='InDebt', description='Indicates whether the WAF instance has overdue payments. Valid values:

*   **0**: The WAF instance does not have overdue payments.
*   **1**: The WAF instance has overdue payments.', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.', example='waf-cn-xxx'),
  payType?: string(name='PayType', description='The billing method of the WAF instance. Valid values:

*   **POSTPAY:** The WAF instance uses the pay-as-you-go billing method.
*   **PREPAY:** The WAF instance uses the subscription billing method.', example='POSTPAY'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='66A98669-CC6E-4F3E-80A6-3014697B11AE'),
  startTime?: long(name='StartTime', description='The purchase time of the WAF instance. The time is in the UNIX timestamp format. The time is displayed in UTC. Unit: milliseconds.', example='1668496310000'),
  status?: int32(name='Status', description='The status of the WAF instance. Valid values:

*   **1:** The WAF instance is in a normal state.
*   **2:** The WAF instance has expired.
*   **3:** The WAF instance has been released.', example='1'),
}

model DescribeInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceResponseBody(name='body'),
}

/**
 * @summary Queries the details of a Web Application Firewall (WAF) instance within the current Alibaba Cloud account.
 *
 * @param request DescribeInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceResponse
 */
async function describeInstanceWithOptions(request: DescribeInstanceRequest, runtime: $RuntimeOptions): DescribeInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeInstance',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details of a Web Application Firewall (WAF) instance within the current Alibaba Cloud account.
 *
 * @param request DescribeInstanceRequest
 * @return DescribeInstanceResponse
 */
async function describeInstance(request: DescribeInstanceRequest): DescribeInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return describeInstanceWithOptions(request, runtime);
}

model DescribeMajorProtectionBlackIpsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  ipLike?: string(name='IpLike', description='The IP address that you want to query. You can specify this parameter to query an IP address in the IP address blacklist for major event protection by using fuzzy matching.', example='192.0.XX.XX'),
  orderBy?: string(name='OrderBy', description='The method that you want to use to sort the IP addresses **in descending order**. Valid values:

*   **gmtModified:** sorts the IP addresses by most recent modification time.
*   **ip:** sorts the IP addresses by IP address.
*   **templateId:** sorts the IP addresses by template ID.
*   **id:** sorts the IP addresses by primary key.', example='gmtModified'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleId?: long(name='RuleId', description='The ID of the IP address blacklist rule for major event protection.', example='20013199'),
  templateId?: long(name='TemplateId', description='The ID of the rule template for major event protection.', example='5673'),
}

model DescribeMajorProtectionBlackIpsResponseBody = {
  ipList?: [ 
    {
      description?: string(name='Description', description='The description of the IP address in the blacklist.', example='test0003asdffas'),
      expiredTime?: long(name='ExpiredTime', description='The time after which the IP address blacklist becomes invalid. Unit: seconds.

>  If the value of this parameter is **0**, the blacklist is permanently valid.', example='1662603328'),
      gmtModified?: long(name='GmtModified', description='The most recent time when the IP address blacklist was modified.', example='1665456202000'),
      ip?: string(name='Ip', description='The IP address in the IP address blacklist.', example='192.0.XX.XX'),
      ruleId?: long(name='RuleId', description='The ID of the IP address blacklist rule for major event protection.', example='8508970'),
      templateId?: long(name='TemplateId', description='The ID of the rule template for major event protection.', example='9684'),
    }
  ](name='IpList', description='An array of IP addresses in the IP address blacklist.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='41631674-EEB0-5B02-BEB4-40A758E9B841'),
  totalCount?: long(name='TotalCount', description='The total number of IP addresses in the blacklist.', example='63'),
}

model DescribeMajorProtectionBlackIpsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeMajorProtectionBlackIpsResponseBody(name='body'),
}

/**
 * @summary Queries IP addresses in an IP address blacklist for major event protection by page.
 *
 * @param request DescribeMajorProtectionBlackIpsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeMajorProtectionBlackIpsResponse
 */
async function describeMajorProtectionBlackIpsWithOptions(request: DescribeMajorProtectionBlackIpsRequest, runtime: $RuntimeOptions): DescribeMajorProtectionBlackIpsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.ipLike)) {
    query['IpLike'] = request.ipLike;
  }
  if (!$isNull(request.orderBy)) {
    query['OrderBy'] = request.orderBy;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeMajorProtectionBlackIps',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries IP addresses in an IP address blacklist for major event protection by page.
 *
 * @param request DescribeMajorProtectionBlackIpsRequest
 * @return DescribeMajorProtectionBlackIpsResponse
 */
async function describeMajorProtectionBlackIps(request: DescribeMajorProtectionBlackIpsRequest): DescribeMajorProtectionBlackIpsResponse {
  var runtime = new $RuntimeOptions{};
  return describeMajorProtectionBlackIpsWithOptions(request, runtime);
}

model DescribeMemberAccountsRequest {
  accountStatus?: string(name='AccountStatus', description='The status of the member that you want to query.

*   **enabled**: managed.
*   **disabled**: not managed.
*   **disabling**: being deleted.', example='enabled'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  sourceIp?: string(name='SourceIp', description='The source IP address of the request. The system specifies this parameter.', example='0.0.XX.XX'),
}

model DescribeMemberAccountsResponseBody = {
  accountInfos?: [ 
    {
      accountId?: string(name='AccountId', description='The ID of the member.', example='169************21'),
      accountName?: string(name='AccountName', description='The name of the member.', example='ipflgmqqnbjg'),
      accountStatus?: string(name='AccountStatus', description='The status of the member.

*   **enabled**: managed.
*   **disabled**: not managed.
*   **disabling**: being deleted.', example='enabled'),
      description?: string(name='Description', description='The description of the member.', example='test'),
      gmtCreate?: long(name='GmtCreate', description='The time when the member was added.', example='1683367751000'),
    }
  ](name='AccountInfos', description='The information about the member.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='50C4A80D-D46C-57E0-9A7D-03C0****4852'),
}

model DescribeMemberAccountsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeMemberAccountsResponseBody(name='body'),
}

/**
 * @summary Queries information about members.
 *
 * @param request DescribeMemberAccountsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeMemberAccountsResponse
 */
async function describeMemberAccountsWithOptions(request: DescribeMemberAccountsRequest, runtime: $RuntimeOptions): DescribeMemberAccountsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.accountStatus)) {
    query['AccountStatus'] = request.accountStatus;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeMemberAccounts',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries information about members.
 *
 * @param request DescribeMemberAccountsRequest
 * @return DescribeMemberAccountsResponse
 */
async function describeMemberAccounts(request: DescribeMemberAccountsRequest): DescribeMemberAccountsResponse {
  var runtime = new $RuntimeOptions{};
  return describeMemberAccountsWithOptions(request, runtime);
}

model DescribeNetworkFlowTimeSeriesMetricRequest {
  filter?: {
    conditions?: [ 
      {
        key?: string(name='Key', description='The filter fields. Valid values:
*   matched_host
*   cluster

For details, see the **Filter fields (Key)** section below.', example='matched_host'),
        opValue?: string(name='OpValue', description='The filter operator. For details, see the **Filter operators (OpValue)** section below.', example='eq'),
        values?: any(name='Values', description='The filter content.', example='test.waf-top'),
      }
    ](name='Conditions', description='The list of filter conditions. Each node describes a filter condition.'),
    dateRange?: {
      endDate?: long(name='EndDate', description='End time of the query range (Unix timestamp, seconds).

This parameter is required.', example='1713888600'),
      startDate?: long(name='StartDate', description='Start time of the query range (Unix timestamp, seconds).

This parameter is required.', example='1713888000'),
    }(name='DateRange', description='Specifies the date range for the query.

This parameter is required.'),
  }(name='Filter', description='Specifies filtering conditions. Multiple filter parameters use AND logic.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The Web Application Firewall (WAF) instance ID.
> Call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to retrieve the WAF instance ID.

This parameter is required.', example='waf_cdnsdf3****'),
  metric?: string(name='Metric', description='Specifies the data type to be returned. Valid values:

*   qps: Returns the queries per second (QPS) processed by WAF. This value is calculated using a peak detection method: QPS is measured every 10 seconds, and the highest value within the specified time range is returned.
*   total_requests: Returns the total number of requests processed by WAF.
*   top5_status: Returns the top 5 HTTP status codes returned by the WAF to clients, along with their corresponding time series statistics.
*   top 5_upstream_status: Returns the top 5 HTTP status codes returned by the origin server to clients, along with their corresponding time series data.

This parameter is required.', example='total_requests'),
  regionId?: string(name='RegionId', description='The region ID of WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The resource group ID.', example='rg-acfm***q'),
}

model DescribeNetworkFlowTimeSeriesMetricShrinkRequest {
  filterShrink?: string(name='Filter', description='Specifies filtering conditions. Multiple filter parameters use AND logic.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The Web Application Firewall (WAF) instance ID.
> Call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to retrieve the WAF instance ID.

This parameter is required.', example='waf_cdnsdf3****'),
  metric?: string(name='Metric', description='Specifies the data type to be returned. Valid values:

*   qps: Returns the queries per second (QPS) processed by WAF. This value is calculated using a peak detection method: QPS is measured every 10 seconds, and the highest value within the specified time range is returned.
*   total_requests: Returns the total number of requests processed by WAF.
*   top5_status: Returns the top 5 HTTP status codes returned by the WAF to clients, along with their corresponding time series statistics.
*   top 5_upstream_status: Returns the top 5 HTTP status codes returned by the origin server to clients, along with their corresponding time series data.

This parameter is required.', example='total_requests'),
  regionId?: string(name='RegionId', description='The region ID of WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The resource group ID.', example='rg-acfm***q'),
}

model DescribeNetworkFlowTimeSeriesMetricResponseBody = {
  networkFlowTimeSeries?: [ 
    {
      metric?: string(name='Metric', description='The metric name, consistent with the Metric request parameter.', example='total_requests'),
      timestamps?: [ string ](name='Timestamps', description='The array of timestamps (seconds) marking the start of each time interval.'),
      values?: [ long ](name='Values', description='The array of counts, each representing the count for the corresponding time interval.'),
    }
  ](name='NetworkFlowTimeSeries', description='The array of time-series data. Supports returning data with multiple values.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D827FCFE-90A7-4330-9326-D33C8B4C7726'),
  timeSeriesMetaData?: {
    aggregateInterval?: string(name='AggregateInterval', description='The time granularity. For example, 15m indicates that each data point is counted every 15 minutes. For details, see the **Time granularity of time series data points** section below.', example='1m'),
    dateRange?: {
      endDate?: long(name='EndDate', description='The end time of the query range (Unix timestamp, seconds). Same as the EndDate request parameter.', example='1713888600'),
      startDate?: long(name='StartDate', description='The start time of the query range (Unix timestamp, seconds). Same as the StartDate request parameter.', example='1713888000'),
    }(name='DateRange', description='The query time range.'),
    units?: string(name='Units', description='The unit of the returned data. It is fixed as requests.', example='requests'),
  }(name='TimeSeriesMetaData', description='The metadata of the returned data.'),
}

model DescribeNetworkFlowTimeSeriesMetricResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeNetworkFlowTimeSeriesMetricResponseBody(name='body'),
}

/**
 * @summary Retrieves time-series data for all network traffic, including both malicious and legitimate requests.
 *
 * @param tmpReq DescribeNetworkFlowTimeSeriesMetricRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeNetworkFlowTimeSeriesMetricResponse
 */
async function describeNetworkFlowTimeSeriesMetricWithOptions(tmpReq: DescribeNetworkFlowTimeSeriesMetricRequest, runtime: $RuntimeOptions): DescribeNetworkFlowTimeSeriesMetricResponse {
  tmpReq.validate();
  var request = new DescribeNetworkFlowTimeSeriesMetricShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'Filter', 'json');
  }
  var query = {};
  if (!$isNull(request.filterShrink)) {
    query['Filter'] = request.filterShrink;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.metric)) {
    query['Metric'] = request.metric;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeNetworkFlowTimeSeriesMetric',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Retrieves time-series data for all network traffic, including both malicious and legitimate requests.
 *
 * @param request DescribeNetworkFlowTimeSeriesMetricRequest
 * @return DescribeNetworkFlowTimeSeriesMetricResponse
 */
async function describeNetworkFlowTimeSeriesMetric(request: DescribeNetworkFlowTimeSeriesMetricRequest): DescribeNetworkFlowTimeSeriesMetricResponse {
  var runtime = new $RuntimeOptions{};
  return describeNetworkFlowTimeSeriesMetricWithOptions(request, runtime);
}

model DescribeNetworkFlowTopNMetricRequest {
  filter?: {
    conditions?: [ 
      {
        key?: string(name='Key', description='The filter fields. Valid values:

*   matched_host
*   cluster

For details, see the **Filter fields (Key)** section below.', example='matched_host'),
        opValue?: string(name='OpValue', description='The filter operator.
For details, see the **Filter operators (OpValue)** section below.', example='eq'),
        values?: any(name='Values', description='The filter content.', example='test.waf-top'),
      }
    ](name='Conditions', description='The list of filter conditions. Each node describes a filter condition.'),
    dateRange?: {
      endDate?: long(name='EndDate', description='End time of the query range (Unix timestamp, seconds).

This parameter is required.', example='1713888600'),
      startDate?: long(name='StartDate', description='Start time of the query range (Unix timestamp, seconds).

This parameter is required.', example='1713888000'),
    }(name='DateRange', description='Specifies the date range for the query.

This parameter is required.'),
  }(name='Filter', description='An array of filter conditions. Multiple filter parameters use AND logic.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The Web Application Firewall (WAF) instance ID.

>  Call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to retrieve the WAF instance ID.

This parameter is required.', example='waf_cdnsdf3****'),
  limit?: long(name='Limit', description='Returns up to 10 data entries, sorted in descending order.

This parameter is required.', example='10'),
  metric?: string(name='Metric', description='Specifies the data type to be returned. Valid values:

*   real_client_ip: The top N requests, sorted in descending order by source IP address, aggregated from all the current user\\\\"s WAF requests.
*   request_path: The top N requests, sorted in descending order by user-agent, aggregated from all the current user\\\\"s WAF requests.
*   request_path: The top N requests, sorted in descending order by request URL, aggregated from all the current user\\\\"s WAF requests.
*   matched_host_by_total_requests: The top N protected objects and their request counts for the current user.
*   matched_host_by_qps: The top N protected objects and their queries per second (QPS) values.
*   matched_host_by_status: When using it, you must specify status in the Conditions field of the Filter parameter. If the HTTP response code returned by WAF matches the status specified in the Conditions, then the top N data is returned, sorted in descending order by protected objects. The format for specifying the status is as follows:\\\\
    {"Key":"status","OpValue":"eq","Values":"200"}
*   matched_host_by_upstream_status: When using it, you must specify upstream_status in the Conditions field of the Filter parameter. If the HTTP response code returned by the origin server matches the upstream_status specified, the top N data is returned, sorted in descending order by protected objects. The format for specifying the upstream_status is as follows:\\\\
    {"Key":"upstream_status","OpValue":"eq","Values":"200"}

This parameter is required.', example='matched_host_by_upstream_status'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The resource group ID.', example='rg-acfm***q'),
}

model DescribeNetworkFlowTopNMetricShrinkRequest {
  filterShrink?: string(name='Filter', description='An array of filter conditions. Multiple filter parameters use AND logic.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The Web Application Firewall (WAF) instance ID.

>  Call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to retrieve the WAF instance ID.

This parameter is required.', example='waf_cdnsdf3****'),
  limit?: long(name='Limit', description='Returns up to 10 data entries, sorted in descending order.

This parameter is required.', example='10'),
  metric?: string(name='Metric', description='Specifies the data type to be returned. Valid values:

*   real_client_ip: The top N requests, sorted in descending order by source IP address, aggregated from all the current user\\\\"s WAF requests.
*   request_path: The top N requests, sorted in descending order by user-agent, aggregated from all the current user\\\\"s WAF requests.
*   request_path: The top N requests, sorted in descending order by request URL, aggregated from all the current user\\\\"s WAF requests.
*   matched_host_by_total_requests: The top N protected objects and their request counts for the current user.
*   matched_host_by_qps: The top N protected objects and their queries per second (QPS) values.
*   matched_host_by_status: When using it, you must specify status in the Conditions field of the Filter parameter. If the HTTP response code returned by WAF matches the status specified in the Conditions, then the top N data is returned, sorted in descending order by protected objects. The format for specifying the status is as follows:\\\\
    {"Key":"status","OpValue":"eq","Values":"200"}
*   matched_host_by_upstream_status: When using it, you must specify upstream_status in the Conditions field of the Filter parameter. If the HTTP response code returned by the origin server matches the upstream_status specified, the top N data is returned, sorted in descending order by protected objects. The format for specifying the upstream_status is as follows:\\\\
    {"Key":"upstream_status","OpValue":"eq","Values":"200"}

This parameter is required.', example='matched_host_by_upstream_status'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The resource group ID.', example='rg-acfm***q'),
}

model DescribeNetworkFlowTopNMetricResponseBody = {
  networkFlowTopNValues?: [ 
    {
      attribute?: string(name='Attribute', description='Returns additional information, such as the country, province, or city to which an IP address belongs.', example='""'),
      name?: string(name='Name', description='The value of this field varies depending on the queried Metric.', example='127.0.0.1'),
      value?: long(name='Value', description='Counts for top ranking.', example='1123'),
    }
  ](name='NetworkFlowTopNValues', description='The top statistical data array returned.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D827FCFE-90A7-4330-9326-D33C8B4C7726'),
  topNMetaData?: {
    dateRange?: {
      endDate?: long(name='EndDate', description='The end time of the query range (Unix timestamp, seconds). Same as the EndDate request parameter.', example='1713888600'),
      startDate?: long(name='StartDate', description='The start time of the query range (Unix timestamp, seconds). Same as the StartDate request parameter.', example='1713888000'),
    }(name='DateRange', description='The query time range.'),
    units?: string(name='Units', description='The unit of the returned data. It is fixed as requests.', example='requests'),
  }(name='TopNMetaData', description='The metadata of the returned data.'),
}

model DescribeNetworkFlowTopNMetricResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeNetworkFlowTopNMetricResponseBody(name='body'),
}

/**
 * @summary Retrieves top aggregated traffic statistics, sorted by various dimensions, including malicious and legitimate requests.
 *
 * @param tmpReq DescribeNetworkFlowTopNMetricRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeNetworkFlowTopNMetricResponse
 */
async function describeNetworkFlowTopNMetricWithOptions(tmpReq: DescribeNetworkFlowTopNMetricRequest, runtime: $RuntimeOptions): DescribeNetworkFlowTopNMetricResponse {
  tmpReq.validate();
  var request = new DescribeNetworkFlowTopNMetricShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'Filter', 'json');
  }
  var query = {};
  if (!$isNull(request.filterShrink)) {
    query['Filter'] = request.filterShrink;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.limit)) {
    query['Limit'] = request.limit;
  }
  if (!$isNull(request.metric)) {
    query['Metric'] = request.metric;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeNetworkFlowTopNMetric',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Retrieves top aggregated traffic statistics, sorted by various dimensions, including malicious and legitimate requests.
 *
 * @param request DescribeNetworkFlowTopNMetricRequest
 * @return DescribeNetworkFlowTopNMetricResponse
 */
async function describeNetworkFlowTopNMetric(request: DescribeNetworkFlowTopNMetricRequest): DescribeNetworkFlowTopNMetricResponse {
  var runtime = new $RuntimeOptions{};
  return describeNetworkFlowTopNMetricWithOptions(request, runtime);
}

model DescribePauseProtectionStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribePauseProtectionStatusResponseBody = {
  pauseStatus?: int32(name='PauseStatus', description='Indicates whether WAF protection is paused.

*   **0**: indicates that WAF protection is not paused. This is the default value.
*   **1**: indicates that WAF protection is paused.', example='0'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-****-46CE-A47C-6B19****5EB0'),
}

model DescribePauseProtectionStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribePauseProtectionStatusResponseBody(name='body'),
}

/**
 * @summary Queries the protection status of Web Application Firewall (WAF).
 *
 * @param request DescribePauseProtectionStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribePauseProtectionStatusResponse
 */
async function describePauseProtectionStatusWithOptions(request: DescribePauseProtectionStatusRequest, runtime: $RuntimeOptions): DescribePauseProtectionStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribePauseProtectionStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the protection status of Web Application Firewall (WAF).
 *
 * @param request DescribePauseProtectionStatusRequest
 * @return DescribePauseProtectionStatusResponse
 */
async function describePauseProtectionStatus(request: DescribePauseProtectionStatusRequest): DescribePauseProtectionStatusResponse {
  var runtime = new $RuntimeOptions{};
  return describePauseProtectionStatusWithOptions(request, runtime);
}

model DescribePeakTrendRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386340'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  interval?: string(name='Interval', description='The time interval. Unit: seconds. The value must be an integral multiple of 60.

This parameter is required.', example='300'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribePeakTrendResponseBody = {
  flowChart?: [ 
    {
      aclSum?: long(name='AclSum', description='The number of requests that are monitored or blocked by the custom rule (access control) module.', example='0'),
      antiScanSum?: long(name='AntiScanSum', description='The number of requests that are monitored or blocked by the scan protection module.', example='0'),
      ccSum?: long(name='CcSum', description='The number of requests that are monitored or blocked by the HTTP flood protection module.', example='0'),
      count?: long(name='Count', description='The total number of requests.', example='2622'),
      index?: long(name='Index', description='The serial number of the time interval. The serial numbers are arranged in chronological order.', example='10'),
      wafSum?: long(name='WafSum', description='The number of requests that are monitored or blocked by the regular expression protection engine.', example='0'),
    }
  ](name='FlowChart', description='An array of the QPS statistics of the WAF instance.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='9D11AC3A-A10C-56E7-A342-E87EC892BAE2'),
}

model DescribePeakTrendResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribePeakTrendResponseBody(name='body'),
}

/**
 * @summary Queries the queries per second (QPS) statistics of a WAF instance.
 *
 * @param request DescribePeakTrendRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribePeakTrendResponse
 */
async function describePeakTrendWithOptions(request: DescribePeakTrendRequest, runtime: $RuntimeOptions): DescribePeakTrendResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.interval)) {
    query['Interval'] = request.interval;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribePeakTrend',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the queries per second (QPS) statistics of a WAF instance.
 *
 * @param request DescribePeakTrendRequest
 * @return DescribePeakTrendResponse
 */
async function describePeakTrend(request: DescribePeakTrendRequest): DescribePeakTrendResponse {
  var runtime = new $RuntimeOptions{};
  return describePeakTrendWithOptions(request, runtime);
}

model DescribeProductInstancesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-zxu****9d02'),
  ownerUserId?: string(name='OwnerUserId', description='The ID of the Alibaba Cloud account to which the resource belongs.', example='1704********9107'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceInstanceId?: string(name='ResourceInstanceId', description='The ID of the instance.', example='lb-2zeugkfj81jvo****4tqm'),
  resourceInstanceIp?: string(name='ResourceInstanceIp', description='The IP address of the instance that is added to WAF.', example='1.X.X.1'),
  resourceInstanceName?: string(name='ResourceInstanceName', description='The name of the instance that is added to WAF.', example='demoInstanceName'),
  resourceIp?: string(name='ResourceIp', description='The public IP address of the instance.', example='1.X.X.1', deprecated=true),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekz6ql****5uzi'),
  resourceName?: string(name='ResourceName', description='The name of the instance.', example='exampleResourceName', deprecated=true),
  resourceProduct?: string(name='ResourceProduct', description='The cloud service to which the instance belongs. Valid values:

*   **clb4**: Layer 4 Classic Load Balancer (CLB).
*   **clb7**: Layer 7 CLB.
*   **ecs**: Elastic Compute Service (ECS).', example='clb7'),
  resourceRegionId?: string(name='ResourceRegionId', description='The region ID of the instance. Valid values:

*   **cn-chengdu**: China (Chengdu).
*   **cn-beijing**: China (Beijing).
*   **cn-zhangjiakou**: China (Zhangjiakou).
*   **cn-hangzhou**: China (Hangzhou).
*   **cn-shanghai**: China (Shanghai).
*   **cn-shenzhen**: China (Shenzhen).
*   **cn-qingdao**: China (Qingdao).
*   **cn-hongkong**: China (Hong Kong).
*   **ap-southeast-3**: Malaysia (Kuala Lumpur).
*   **ap-southeast-5**: Indonesia (Jakarta).', example='cn-hangzhou'),
}

model DescribeProductInstancesResponseBody = {
  productInstances?: [ 
    {
      ownerUserId?: string(name='OwnerUserId', description='The ID of the Alibaba Cloud account to which the resource belongs.', example='1704********9107'),
      resourceInstanceId?: string(name='ResourceInstanceId', description='The ID of the instance.', example='i-2ze1tm4pvghp****cluv'),
      resourceInstanceIp?: string(name='ResourceInstanceIp', description='The IP address of the instance that is added to WAF.', example='1.X.X.1'),
      resourceInstanceName?: string(name='ResourceInstanceName', description='The name of the instance that is added to WAF.', example='demoInstanceName'),
      resourceIp?: string(name='ResourceIp', description='The public IP address of the instance.', example='1.X.X.1', deprecated=true),
      resourceName?: string(name='ResourceName', description='The name of the instance.', example='ecs-test', deprecated=true),
      resourcePorts?: [ 
        {
          certificates?: [ 
            {
              certificateId?: string(name='CertificateId', description='The ID of the certificate.', example='10106183'),
              certificateName?: string(name='CertificateName', description='The name of the certificate.', example='trafficxxxx.cn'),
            }
          ](name='Certificates', description='The information about the certificates.'),
          port?: int32(name='Port', description='The port number.', example='443'),
          protocol?: string(name='Protocol', description='The protocol type. Valid values:

*   **http**
*   **https**', example='https'),
        }
      ](name='ResourcePorts', description='The information about the ports.'),
      resourceProduct?: string(name='ResourceProduct', description='The cloud service to which the instance belongs. Valid values:

*   **clb4**: Layer 4 CLB.
*   **clb7**: Layer 7 CLB.
*   **ecs**: ECS.', example='clb4'),
      resourceRegionId?: string(name='ResourceRegionId', description='The region ID of the instance. Valid values:

*   **cn-chengdu**: China (Chengdu).
*   **cn-beijing**: China (Beijing).
*   **cn-zhangjiakou**: China (Zhangjiakou).
*   **cn-hangzhou**: China (Hangzhou).
*   **cn-shanghai**: China (Shanghai).
*   **cn-shenzhen**: China (Shenzhen).
*   **cn-qingdao**: China (Qingdao).
*   **cn-hongkong**: China (Hong Kong).
*   **ap-southeast-3**: Malaysia (Kuala Lumpur).
*   **ap-southeast-5**: Indonesia (Jakarta).', example='cn-beijing'),
    }
  ](name='ProductInstances', description='The information about the instances.'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='FDCBAE1E-2B3F-5C13-AD20-844B9473****'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='100'),
}

model DescribeProductInstancesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeProductInstancesResponseBody(name='body'),
}

/**
 * @summary Queries the cloud service instances to be added to Web Application Firewall (WAF) in transparent proxy mode.
 *
 * @param request DescribeProductInstancesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeProductInstancesResponse
 */
async function describeProductInstancesWithOptions(request: DescribeProductInstancesRequest, runtime: $RuntimeOptions): DescribeProductInstancesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.ownerUserId)) {
    query['OwnerUserId'] = request.ownerUserId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceInstanceId)) {
    query['ResourceInstanceId'] = request.resourceInstanceId;
  }
  if (!$isNull(request.resourceInstanceIp)) {
    query['ResourceInstanceIp'] = request.resourceInstanceIp;
  }
  if (!$isNull(request.resourceInstanceName)) {
    query['ResourceInstanceName'] = request.resourceInstanceName;
  }
  if (!$isNull(request.resourceIp)) {
    query['ResourceIp'] = request.resourceIp;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceName)) {
    query['ResourceName'] = request.resourceName;
  }
  if (!$isNull(request.resourceProduct)) {
    query['ResourceProduct'] = request.resourceProduct;
  }
  if (!$isNull(request.resourceRegionId)) {
    query['ResourceRegionId'] = request.resourceRegionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeProductInstances',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the cloud service instances to be added to Web Application Firewall (WAF) in transparent proxy mode.
 *
 * @param request DescribeProductInstancesRequest
 * @return DescribeProductInstancesResponse
 */
async function describeProductInstances(request: DescribeProductInstancesRequest): DescribeProductInstancesResponse {
  var runtime = new $RuntimeOptions{};
  return describeProductInstancesWithOptions(request, runtime);
}

model DescribePunishedDomainsRequest {
  domains?: [ string ](name='Domains', description='The domain names that are added to WAF.'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-uqm****qa07'),
  punishType?: string(name='PunishType', description='The type of punishment. Valid values:

*   **beian** (default): the filing center.
*   **punishCenter**: the punishment center.', example='beian'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekz7nc****aata'),
}

model DescribePunishedDomainsResponseBody = {
  punishedDomains?: [ string ](name='PunishedDomains', description='The domain names that are penalized for failing to obtain an ICP filing.'),
  requestId?: string(name='RequestId', description='The request ID.', example='B1F4D802-55A1-5D53-A247-7E79****85E7'),
}

model DescribePunishedDomainsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribePunishedDomainsResponseBody(name='body'),
}

/**
 * @summary Queries a list of domain names that are added to Web Application Firewall (WAF) and penalized for failing to obtain an Internet Content Provider (ICP) filing.
 *
 * @param request DescribePunishedDomainsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribePunishedDomainsResponse
 */
async function describePunishedDomainsWithOptions(request: DescribePunishedDomainsRequest, runtime: $RuntimeOptions): DescribePunishedDomainsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.domains)) {
    query['Domains'] = request.domains;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.punishType)) {
    query['PunishType'] = request.punishType;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribePunishedDomains',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of domain names that are added to Web Application Firewall (WAF) and penalized for failing to obtain an Internet Content Provider (ICP) filing.
 *
 * @param request DescribePunishedDomainsRequest
 * @return DescribePunishedDomainsResponse
 */
async function describePunishedDomains(request: DescribePunishedDomainsRequest): DescribePunishedDomainsResponse {
  var runtime = new $RuntimeOptions{};
  return describePunishedDomainsWithOptions(request, runtime);
}

model DescribeResourceInstanceCertsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-*'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceInstanceId?: string(name='ResourceInstanceId', description='The ID of the instance.', example='lb-bp1*****jqnnqk5uj2p'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeResourceInstanceCertsResponseBody = {
  certs?: [ 
    {
      afterDate?: long(name='AfterDate', description='The time when the certificate expires.', example='1708415521211'),
      beforeDate?: long(name='BeforeDate', description='The time when the certificate was issued.', example='1708415521211'),
      certIdentifier?: string(name='CertIdentifier', description='The globally unique ID of the certificate. The value is in the "Certificate ID-cn-hangzhou" format. For example, if the ID of the certificate is 123, the value of CertIdentifier is 123-cn-hangzhou.', example='123-cn-hangzhou'),
      certName?: string(name='CertName', description='The name of the certificate.', example='demoCertName'),
      commonName?: string(name='CommonName', description='The common name.', example='*.aliyundemo.com'),
      domain?: string(name='Domain', description='The domain name for which the certificate is issued.', example='waf.aliyundemo.com'),
      isChainCompleted?: boolean(name='IsChainCompleted', description='Indicates whether the certificate chain is complete.', example='true'),
    }
  ](name='Certs', description='The certificates.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-***-6B19160D5EB0'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='1'),
}

model DescribeResourceInstanceCertsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeResourceInstanceCertsResponseBody(name='body'),
}

/**
 * @summary Queries the certificates that are used in cloud service instances. The certificates returned include the certificates within the delegated administrator account and the certificates within members to which specific instances belong. For example, the delegated administrator account has certificate 1, instance lb-xx-1 belongs to member B, and member B has certificate 2. If you specify instance lb-xx-1 in the request, certificate 1 and certificate 2 are returned.
 *
 * @param request DescribeResourceInstanceCertsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeResourceInstanceCertsResponse
 */
async function describeResourceInstanceCertsWithOptions(request: DescribeResourceInstanceCertsRequest, runtime: $RuntimeOptions): DescribeResourceInstanceCertsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceInstanceId)) {
    query['ResourceInstanceId'] = request.resourceInstanceId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeResourceInstanceCerts',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the certificates that are used in cloud service instances. The certificates returned include the certificates within the delegated administrator account and the certificates within members to which specific instances belong. For example, the delegated administrator account has certificate 1, instance lb-xx-1 belongs to member B, and member B has certificate 2. If you specify instance lb-xx-1 in the request, certificate 1 and certificate 2 are returned.
 *
 * @param request DescribeResourceInstanceCertsRequest
 * @return DescribeResourceInstanceCertsResponse
 */
async function describeResourceInstanceCerts(request: DescribeResourceInstanceCertsRequest): DescribeResourceInstanceCertsResponse {
  var runtime = new $RuntimeOptions{};
  return describeResourceInstanceCertsWithOptions(request, runtime);
}

model DescribeResourceLogStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf-cn-zz11zcl****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  resources?: string(name='Resources', description='The protected object that you want to query. You can specify multiple protected objects. Separate the protected objects with commas (,).

This parameter is required.', example='alb-wewbb23dfsetetcic1242-0****,alb-wewbb23dfsetetcic1242-1****'),
}

model DescribeResourceLogStatusResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='0DABF8AB-2321-5F8D-A8D7-922D757FBFFE'),
  result?: [ 
    {
      resource?: string(name='Resource', description='The protected object.', example='alb-wewbb23dfsetetcic****'),
      status?: boolean(name='Status', description='Indicates whether the log collection feature is enabled for the protected object. Valid values:

*   **true:** The log collection feature is enabled.
*   **false:** The log collection feature is disabled.', example='true'),
    }
  ](name='Result', description='The returned result.'),
}

model DescribeResourceLogStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeResourceLogStatusResponseBody(name='body'),
}

/**
 * @summary Queries whether the log collection feature is enabled for a protected object.
 *
 * @param request DescribeResourceLogStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeResourceLogStatusResponse
 */
async function describeResourceLogStatusWithOptions(request: DescribeResourceLogStatusRequest, runtime: $RuntimeOptions): DescribeResourceLogStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resources)) {
    query['Resources'] = request.resources;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeResourceLogStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries whether the log collection feature is enabled for a protected object.
 *
 * @param request DescribeResourceLogStatusRequest
 * @return DescribeResourceLogStatusResponse
 */
async function describeResourceLogStatus(request: DescribeResourceLogStatusRequest): DescribeResourceLogStatusResponse {
  var runtime = new $RuntimeOptions{};
  return describeResourceLogStatusWithOptions(request, runtime);
}

model DescribeResourcePortRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceInstanceId?: string(name='ResourceInstanceId', description='The ID of the cloud service instance.

This parameter is required.', example='8vb40vj87znu3ai7l5lv4-80****'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeResourcePortResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='66A98669-CC6E-4F3E-80A6-3014697B11AE'),
  resourcePorts?: [ string ](name='ResourcePorts', description='An array of HTTP and HTTPS listener ports that are added to the WAF instance.'),
}

model DescribeResourcePortResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeResourcePortResponseBody(name='body'),
}

/**
 * @summary Queries the ports of a cloud service instance that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeResourcePortRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeResourcePortResponse
 */
async function describeResourcePortWithOptions(request: DescribeResourcePortRequest, runtime: $RuntimeOptions): DescribeResourcePortResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceInstanceId)) {
    query['ResourceInstanceId'] = request.resourceInstanceId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeResourcePort',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the ports of a cloud service instance that are added to Web Application Firewall (WAF).
 *
 * @param request DescribeResourcePortRequest
 * @return DescribeResourcePortResponse
 */
async function describeResourcePort(request: DescribeResourcePortRequest): DescribeResourcePortResponse {
  var runtime = new $RuntimeOptions{};
  return describeResourcePortWithOptions(request, runtime);
}

model DescribeResourceRegionIdRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aek2lrm****6pnq'),
}

model DescribeResourceRegionIdResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='F5905D3F-F674-5177-9E48-466DD3B8****'),
  resourceRegionIds?: [ string ](name='ResourceRegionIds', description='The region IDs of the resources that are added to Web Application Firewall (WAF) by using the SDK integration mode.'),
}

model DescribeResourceRegionIdResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeResourceRegionIdResponseBody(name='body'),
}

/**
 * @summary Queries the region IDs of the resources that are added to Web Application Firewall (WAF) by using the SDK integration mode. The resources refer to Application Load Balancer (ALB) and Microservices Engine (MSE) instances.
 *
 * @param request DescribeResourceRegionIdRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeResourceRegionIdResponse
 */
async function describeResourceRegionIdWithOptions(request: DescribeResourceRegionIdRequest, runtime: $RuntimeOptions): DescribeResourceRegionIdResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeResourceRegionId',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the region IDs of the resources that are added to Web Application Firewall (WAF) by using the SDK integration mode. The resources refer to Application Load Balancer (ALB) and Microservices Engine (MSE) instances.
 *
 * @param request DescribeResourceRegionIdRequest
 * @return DescribeResourceRegionIdResponse
 */
async function describeResourceRegionId(request: DescribeResourceRegionIdRequest): DescribeResourceRegionIdResponse {
  var runtime = new $RuntimeOptions{};
  return describeResourceRegionIdWithOptions(request, runtime);
}

model DescribeResourceSupportRegionsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekzpks****kdjq'),
  resourceProduct?: string(name='ResourceProduct', description='The cloud service. Valid values:

*   **clb4**: Layer 4 CLB.
*   **clb7**: Layer 7 CLB.
*   **ecs**: ECS.', example='clb7'),
}

model DescribeResourceSupportRegionsResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='58FD****-3D56-5DE8-91E0-96A26BABFFDD'),
  supportRegions?: [ string ](name='SupportRegions', description='An array of region IDs of the CLB and ECS instances that are added to WAF in cloud native mode.'),
}

model DescribeResourceSupportRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeResourceSupportRegionsResponseBody(name='body'),
}

/**
 * @summary Queries the region IDs of the Classic Load Balancer (CLB) and Elastic Compute Service (ECS) instances that are added to Web Application Firewall (WAF) in cloud native mode.
 *
 * @param request DescribeResourceSupportRegionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeResourceSupportRegionsResponse
 */
async function describeResourceSupportRegionsWithOptions(request: DescribeResourceSupportRegionsRequest, runtime: $RuntimeOptions): DescribeResourceSupportRegionsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceProduct)) {
    query['ResourceProduct'] = request.resourceProduct;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeResourceSupportRegions',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the region IDs of the Classic Load Balancer (CLB) and Elastic Compute Service (ECS) instances that are added to Web Application Firewall (WAF) in cloud native mode.
 *
 * @param request DescribeResourceSupportRegionsRequest
 * @return DescribeResourceSupportRegionsResponse
 */
async function describeResourceSupportRegions(request: DescribeResourceSupportRegionsRequest): DescribeResourceSupportRegionsResponse {
  var runtime = new $RuntimeOptions{};
  return describeResourceSupportRegionsWithOptions(request, runtime);
}

model DescribeResponseCodeTrendGraphRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386280'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  interval?: string(name='Interval', description='The time interval. Unit: seconds. The value must be an integral multiple of 60.

This parameter is required.', example='300'),
  regionId?: string(name='RegionId', description='The ID of the region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
  type?: string(name='Type', description='The type of the error codes. Valid values:

*   **waf:** error codes that are returned to clients from WAF.
*   **upstream:** error codes that are returned to WAF from the origin server.

This parameter is required.', example='waf'),
}

model DescribeResponseCodeTrendGraphResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='7D46493E-84DD-58CE-80A7-8643****9ECC'),
  responseCodes?: [ 
    {
      code302Pv?: long(name='302Pv', description='The number of 302 error codes that are returned.', example='0'),
      code405Pv?: long(name='405Pv', description='The number of 405 error codes that are returned.', example='121645464'),
      code444Pv?: long(name='444Pv', description='The number of 444 error codes that are returned.', example='0'),
      code499Pv?: long(name='499Pv', description='The number of 499 error codes that are returned.', example='0'),
      code5xxPv?: long(name='5xxPv', description='The number of 5xx error codes that are returned.', example='2932'),
      index?: long(name='Index', description='The serial number of the time interval. The serial numbers are arranged in chronological order.', example='10'),
    }
  ](name='ResponseCodes', description='The array of the statistics of the error codes.'),
}

model DescribeResponseCodeTrendGraphResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeResponseCodeTrendGraphResponseBody(name='body'),
}

/**
 * @summary Queries the trend of the number of error codes that are returned to clients or Web Application Firewall (WAF). The error codes include 302, 405, 444, 499, and 5XX.
 *
 * @param request DescribeResponseCodeTrendGraphRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeResponseCodeTrendGraphResponse
 */
async function describeResponseCodeTrendGraphWithOptions(request: DescribeResponseCodeTrendGraphRequest, runtime: $RuntimeOptions): DescribeResponseCodeTrendGraphResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.interval)) {
    query['Interval'] = request.interval;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeResponseCodeTrendGraph',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the trend of the number of error codes that are returned to clients or Web Application Firewall (WAF). The error codes include 302, 405, 444, 499, and 5XX.
 *
 * @param request DescribeResponseCodeTrendGraphRequest
 * @return DescribeResponseCodeTrendGraphResponse
 */
async function describeResponseCodeTrendGraph(request: DescribeResponseCodeTrendGraphRequest): DescribeResponseCodeTrendGraphResponse {
  var runtime = new $RuntimeOptions{};
  return describeResponseCodeTrendGraphWithOptions(request, runtime);
}

model DescribeRuleGroupsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  pageNumber?: int32(name='PageNumber', description='The number of the page to return. Default value: **1**.', example='1'),
  pageSize?: int32(name='PageSize', description='The number of entries to return on each page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  searchType?: string(name='SearchType', description='The type of the query condition. Valid values:

*   **id:** queries regular expression rule groups by ID.
*   **name:** queries regular expression rule groups by name.', example='name'),
  searchValue?: string(name='SearchValue', description='The query condition.', example='test'),
}

model DescribeRuleGroupsResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='02E9A4B8-90FB-5F41-A049-C82277EB82FB'),
  ruleGroups?: [ 
    {
      gmtModified?: long(name='GmtModified', description='The most recent time when the rule group was modified.', example='1664336364000'),
      isSubscribe?: int32(name='IsSubscribe', description='Indicates whether the automatic update feature is enabled for the rule group.

*   1: The automatic update feature is enabled for the rule group.
*   2: The automatic update feature is disabled for the rule group.', example='1'),
      parentRuleGroupId?: long(name='ParentRuleGroupId', description='The ID of the rule group.

*   0: The rule group is created from scratch.
*   1011: The rule group is a strict rule group.
*   1012: The rule group is a medium rule group.
*   1013: The rue group is a loose rule group.', example='1012'),
      ruleGroupId?: long(name='RuleGroupId', description='The ID of the regular expression rule group.', example='115361'),
      ruleGroupName?: string(name='RuleGroupName', description='The name of the rule group.', example='ssssss'),
      ruleTotalCount?: int32(name='RuleTotalCount', description='The number of built-in rules in the rule group.', example='4444'),
    }
  ](name='RuleGroups', description='An array of regular expression rule groups.'),
  totalCount?: long(name='TotalCount', description='The total number of entries that are returned.', example='24'),
}

model DescribeRuleGroupsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRuleGroupsResponseBody(name='body'),
}

/**
 * @summary Queries regular expression rule groups by page.
 *
 * @param request DescribeRuleGroupsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRuleGroupsResponse
 */
async function describeRuleGroupsWithOptions(request: DescribeRuleGroupsRequest, runtime: $RuntimeOptions): DescribeRuleGroupsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.searchType)) {
    query['SearchType'] = request.searchType;
  }
  if (!$isNull(request.searchValue)) {
    query['SearchValue'] = request.searchValue;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeRuleGroups',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries regular expression rule groups by page.
 *
 * @param request DescribeRuleGroupsRequest
 * @return DescribeRuleGroupsResponse
 */
async function describeRuleGroups(request: DescribeRuleGroupsRequest): DescribeRuleGroupsResponse {
  var runtime = new $RuntimeOptions{};
  return describeRuleGroupsWithOptions(request, runtime);
}

model DescribeRuleHitsTopClientIpRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386280'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleType?: string(name='RuleType', description='The type of rules that are triggered by the protected object. By default, this parameter is not specified and all types of rules are queried.

*   **blacklist:** IP address blacklist rules.
*   **custom:** custom rules.
*   **antiscan:** scan protection rules.
*   **cc_system:** HTTP flood protection rules.
*   **region_block:** region blacklist rules.', example='blacklist'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeRuleHitsTopClientIpResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9F0F9AD6-62E2-50BB-A3E5-30FFB9410262'),
  ruleHitsTopClientIp?: [ 
    {
      clientIp?: string(name='ClientIp', description='The IP address of the service client.', example='3.3.XX.XX'),
      count?: long(name='Count', description='The number of attacks that are initiated from the IP address.', example='531'),
    }
  ](name='RuleHitsTopClientIp', description='The array of the top 10 IP addresses from which attacks are initiated.'),
}

model DescribeRuleHitsTopClientIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRuleHitsTopClientIpResponseBody(name='body'),
}

/**
 * @summary Queries the top 10 IP addresses from which attacks are initiated.
 *
 * @param request DescribeRuleHitsTopClientIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRuleHitsTopClientIpResponse
 */
async function describeRuleHitsTopClientIpWithOptions(request: DescribeRuleHitsTopClientIpRequest, runtime: $RuntimeOptions): DescribeRuleHitsTopClientIpResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeRuleHitsTopClientIp',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the top 10 IP addresses from which attacks are initiated.
 *
 * @param request DescribeRuleHitsTopClientIpRequest
 * @return DescribeRuleHitsTopClientIpResponse
 */
async function describeRuleHitsTopClientIp(request: DescribeRuleHitsTopClientIpRequest): DescribeRuleHitsTopClientIpResponse {
  var runtime = new $RuntimeOptions{};
  return describeRuleHitsTopClientIpWithOptions(request, runtime);
}

model DescribeRuleHitsTopResourceRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386340'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleType?: string(name='RuleType', description='The type of rules that are triggered by the protected object. By default, this parameter is not specified and all types of rules are queried.

*   **blacklist:** IP address blacklist rules.
*   **custom:** custom rules.
*   **antiscan:** scan protection rules.
*   **cc_system:** HTTP flood protection rules.
*   **region_block:** region blacklist rules.', example='blacklist'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeRuleHitsTopResourceResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='ADA11BC7-AA95-5C31-9095-5802C02ED1DC'),
  ruleHitsTopResource?: [ 
    {
      count?: long(name='Count', description='The number of requests that match protection rules.', example='14219'),
      resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
    }
  ](name='RuleHitsTopResource', description='The array of the top 10 protected objects that trigger protection rules.'),
}

model DescribeRuleHitsTopResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRuleHitsTopResourceResponseBody(name='body'),
}

/**
 * @summary Queries the top 10 protected objects that trigger protection rules.
 *
 * @param request DescribeRuleHitsTopResourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRuleHitsTopResourceResponse
 */
async function describeRuleHitsTopResourceWithOptions(request: DescribeRuleHitsTopResourceRequest, runtime: $RuntimeOptions): DescribeRuleHitsTopResourceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeRuleHitsTopResource',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the top 10 protected objects that trigger protection rules.
 *
 * @param request DescribeRuleHitsTopResourceRequest
 * @return DescribeRuleHitsTopResourceResponse
 */
async function describeRuleHitsTopResource(request: DescribeRuleHitsTopResourceRequest): DescribeRuleHitsTopResourceResponse {
  var runtime = new $RuntimeOptions{};
  return describeRuleHitsTopResourceWithOptions(request, runtime);
}

model DescribeRuleHitsTopRuleIdRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386280'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  isGroupResource?: string(name='IsGroupResource', description='Specifies whether protected objects that trigger protection rules are returned in the response. Valid values

- **true**: returns only the number of times each protection rule is triggered. If you set IsGroupResource to true, Resource is left empty.
- **false**: returns the number of times each protection rule is triggered by each protected object.', example='true'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  ruleType?: string(name='RuleType', description='The type of rules that are triggered by the protected object. By default, this parameter is not specified and all types of rules are queried.

*   **blacklist:** IP address blacklist rules.
*   **custom:** custom rules.
*   **antiscan:** scan protection rules.
*   **cc_system:** HTTP flood protection rules.
*   **region_block:** region blacklist rules.', example='blacklist'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeRuleHitsTopRuleIdResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='F6334274-8870-5D2F-A1AD-D6EF885AC1ED'),
  ruleHitsTopRuleId?: [ 
    {
      count?: long(name='Count', description='The number of requests that match the rule.', example='181174784'),
      resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
      ruleId?: string(name='RuleId', description='The ID of the rule.', example='5465465'),
    }
  ](name='RuleHitsTopRuleId', description='The array of the IDs of the top 10 rules that are matched by requests.'),
}

model DescribeRuleHitsTopRuleIdResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRuleHitsTopRuleIdResponseBody(name='body'),
}

/**
 * @summary Queries the IDs of the top 10 protection rules that are matched by requests.
 *
 * @param request DescribeRuleHitsTopRuleIdRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRuleHitsTopRuleIdResponse
 */
async function describeRuleHitsTopRuleIdWithOptions(request: DescribeRuleHitsTopRuleIdRequest, runtime: $RuntimeOptions): DescribeRuleHitsTopRuleIdResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.isGroupResource)) {
    query['IsGroupResource'] = request.isGroupResource;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeRuleHitsTopRuleId',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the IDs of the top 10 protection rules that are matched by requests.
 *
 * @param request DescribeRuleHitsTopRuleIdRequest
 * @return DescribeRuleHitsTopRuleIdResponse
 */
async function describeRuleHitsTopRuleId(request: DescribeRuleHitsTopRuleIdRequest): DescribeRuleHitsTopRuleIdResponse {
  var runtime = new $RuntimeOptions{};
  return describeRuleHitsTopRuleIdWithOptions(request, runtime);
}

model DescribeRuleHitsTopTuleTypeRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end point of the time period for which to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386280'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The ID of the region where the WAF instance resides. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekzwwkpn****5i'),
  startTimestamp?: string(name='StartTimestamp', description='The start point of the time period for which to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeRuleHitsTopTuleTypeResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='45E377CE-0B04-578E-B653-EEA63CFE****'),
  ruleHitsTopTuleType?: [ 
    {
      count?: long(name='Count', description='The number of requests that match protection rules.', example='698455'),
      ruleType?: string(name='RuleType', description='The type of rule that is matched. By default, this parameter is not returned. This indicates that all types of rules that are matched are returned.

*   **waf:** basic protection rules.
*   **blacklist:** IP address blacklist rules.
*   **custom:** custom rules.
*   **antiscan:** scan protection rules.
*   **cc_system:** HTTP flood protection rules.
*   **region_block:** region blacklist rules.
*   **scene:** bot management rules.
*   **dlp:** data leakage prevention rules.', example='cc_system'),
    }
  ](name='RuleHitsTopTuleType', description='The top 10 protection modules that are matched.'),
}

model DescribeRuleHitsTopTuleTypeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRuleHitsTopTuleTypeResponseBody(name='body'),
}

/**
 * @summary Queries the top 10 protection modules that are matched.
 *
 * @param request DescribeRuleHitsTopTuleTypeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRuleHitsTopTuleTypeResponse
 */
async function describeRuleHitsTopTuleTypeWithOptions(request: DescribeRuleHitsTopTuleTypeRequest, runtime: $RuntimeOptions): DescribeRuleHitsTopTuleTypeResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeRuleHitsTopTuleType',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the top 10 protection modules that are matched.
 *
 * @param request DescribeRuleHitsTopTuleTypeRequest
 * @return DescribeRuleHitsTopTuleTypeResponse
 */
async function describeRuleHitsTopTuleType(request: DescribeRuleHitsTopTuleTypeRequest): DescribeRuleHitsTopTuleTypeResponse {
  var runtime = new $RuntimeOptions{};
  return describeRuleHitsTopTuleTypeWithOptions(request, runtime);
}

model DescribeRuleHitsTopUaRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386280'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeRuleHitsTopUaResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='8E5C7ED7-503A-5986-A005-36F2511EB89F'),
  ruleHitsTopUa?: [ 
    {
      count?: long(name='Count', description='The number of attacks that are initiated from the IP address.', example='531'),
      ua?: string(name='Ua', description='The user agent.', example='android'),
    }
  ](name='RuleHitsTopUa', description='The array of the top 10 user agents that are used to initiate attacks.'),
}

model DescribeRuleHitsTopUaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRuleHitsTopUaResponseBody(name='body'),
}

/**
 * @summary Queries the top 10 user agents that are used to initiate attacks.
 *
 * @param request DescribeRuleHitsTopUaRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRuleHitsTopUaResponse
 */
async function describeRuleHitsTopUaWithOptions(request: DescribeRuleHitsTopUaRequest, runtime: $RuntimeOptions): DescribeRuleHitsTopUaResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeRuleHitsTopUa',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the top 10 user agents that are used to initiate attacks.
 *
 * @param request DescribeRuleHitsTopUaRequest
 * @return DescribeRuleHitsTopUaResponse
 */
async function describeRuleHitsTopUa(request: DescribeRuleHitsTopUaRequest): DescribeRuleHitsTopUaResponse {
  var runtime = new $RuntimeOptions{};
  return describeRuleHitsTopUaWithOptions(request, runtime);
}

model DescribeRuleHitsTopUrlRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386280'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.

This parameter is required.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleType?: string(name='RuleType', description='The type of rules that are triggered by the protected object. By default, this parameter is not specified and all types of rules are queried.

*   **blacklist:** IP address blacklist rules.
*   **custom:** custom rules.
*   **antiscan:** scan protection rules.
*   **cc_system:** HTTP flood protection rules.
*   **region_block:** region blacklist rules.', example='blacklist'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeRuleHitsTopUrlResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='3D8AF43B-08EB-51CE-B33A-93AA****9B0C'),
  ruleHitsTopUrl?: [ 
    {
      count?: long(name='Count', description='The number of requests that match protection rules.', example='21862'),
      url?: string(name='Url', description='The request URL.

>  The value is Base64-encoded.', example='d3d3LmFsaXl1bmRvYy5jb20vcGF0aDM='),
    }
  ](name='RuleHitsTopUrl', description='The top 10 URLs that match protection rules.'),
}

model DescribeRuleHitsTopUrlResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRuleHitsTopUrlResponseBody(name='body'),
}

/**
 * @summary Queries the top 10 URLs that trigger protection rules.
 *
 * @param request DescribeRuleHitsTopUrlRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRuleHitsTopUrlResponse
 */
async function describeRuleHitsTopUrlWithOptions(request: DescribeRuleHitsTopUrlRequest, runtime: $RuntimeOptions): DescribeRuleHitsTopUrlResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeRuleHitsTopUrl',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the top 10 URLs that trigger protection rules.
 *
 * @param request DescribeRuleHitsTopUrlRequest
 * @return DescribeRuleHitsTopUrlResponse
 */
async function describeRuleHitsTopUrl(request: DescribeRuleHitsTopUrlRequest): DescribeRuleHitsTopUrlResponse {
  var runtime = new $RuntimeOptions{};
  return describeRuleHitsTopUrlWithOptions(request, runtime);
}

model DescribeSecurityEventLogsRequest {
  filter?: {
    conditions?: [ 
      {
        key?: string(name='Key', description='The field name. This operation supports all fields. For more information, see the **Supported field names** section below.', example='matched_host'),
        opValue?: string(name='OpValue', description='The operator. For more information, see the **Supported operators** section below.', example='eq'),
        values?: any(name='Values', description='The field content.', example='test.waf-top'),
      }
    ](name='Conditions', description='The filter conditions. Each object describes a filter condition.'),
    dateRange?: {
      endDate?: long(name='EndDate', description='The end of the time range to query. The value is a UNIX timestamp. Unit: seconds.

This parameter is required.', example='1713888600'),
      startDate?: long(name='StartDate', description='The beginning of the time range to query. The value is a UNIX timestamp. Unit: seconds.

This parameter is required.', example='1713888000'),
    }(name='DateRange', description='The time range for the query.

This parameter is required.'),
  }(name='Filter', description='The filter conditions for the query. Multiple conditions are evaluated by using a logical AND.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.

This parameter is required.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Maximum value: **100**.

This parameter is required.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeSecurityEventLogsShrinkRequest {
  filterShrink?: string(name='Filter', description='The filter conditions for the query. Multiple conditions are evaluated by using a logical AND.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.

This parameter is required.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Maximum value: **100**.

This parameter is required.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeSecurityEventLogsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D827FCFE-90A7-4330-9326-D33C8B4C7726'),
  securityEventLogs?: [ any ](name='SecurityEventLogs', description='The attack logs returned.'),
  securityEventLogsTotalCount?: long(name='SecurityEventLogsTotalCount', description='The total number of logs returned.', example='1000'),
  securityEventMetaData?: {
    dateRange?: {
      endDate?: long(name='EndDate', description='The end of the time range to query. The value is a UNIX timestamp. Unit: seconds. This value is the same as the value of EndDate in the request parameters.', example='1713888600'),
      startDate?: long(name='StartDate', description='The beginning of the time range to query. The value is a UNIX timestamp. Unit: seconds. This value is the same as the value of StartDate in the request parameters.', example='1713888000'),
    }(name='DateRange', description='The time range that is used for the query.'),
    units?: string(name='Units', description='The unit of the statistics returned. The value is fixed as requests.', example='requests'),
  }(name='SecurityEventMetaData', description='The metadata of the time series data returned.'),
}

model DescribeSecurityEventLogsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSecurityEventLogsResponseBody(name='body'),
}

/**
 * @summary Queries the logs of attack traffic. Each log records the details of a request that matches protection rules.
 *
 * @description Attack traffic refers to the traffic of requests that match protection rules and are identified as risky. The following types of requests are excluded:
 * *   Requests that match the protection rules of the whitelist module.
 * *   Requests that match the protection rules of the bot management module. The actions of the protection rules are set to Add Tag.
 * *   Requests that match protection rules with actions set to Dynamic Token-based Authentication, Slider CAPTCHA, Strict Slider CAPTCHA Verification, and JavaScript Validation, pass the verifications specified by the actions, and are allowed.
 *
 * @param tmpReq DescribeSecurityEventLogsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSecurityEventLogsResponse
 */
async function describeSecurityEventLogsWithOptions(tmpReq: DescribeSecurityEventLogsRequest, runtime: $RuntimeOptions): DescribeSecurityEventLogsResponse {
  tmpReq.validate();
  var request = new DescribeSecurityEventLogsShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'Filter', 'json');
  }
  var query = {};
  if (!$isNull(request.filterShrink)) {
    query['Filter'] = request.filterShrink;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSecurityEventLogs',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the logs of attack traffic. Each log records the details of a request that matches protection rules.
 *
 * @description Attack traffic refers to the traffic of requests that match protection rules and are identified as risky. The following types of requests are excluded:
 * *   Requests that match the protection rules of the whitelist module.
 * *   Requests that match the protection rules of the bot management module. The actions of the protection rules are set to Add Tag.
 * *   Requests that match protection rules with actions set to Dynamic Token-based Authentication, Slider CAPTCHA, Strict Slider CAPTCHA Verification, and JavaScript Validation, pass the verifications specified by the actions, and are allowed.
 *
 * @param request DescribeSecurityEventLogsRequest
 * @return DescribeSecurityEventLogsResponse
 */
async function describeSecurityEventLogs(request: DescribeSecurityEventLogsRequest): DescribeSecurityEventLogsResponse {
  var runtime = new $RuntimeOptions{};
  return describeSecurityEventLogsWithOptions(request, runtime);
}

model DescribeSecurityEventTimeSeriesMetricRequest {
  filter?: {
    conditions?: [ 
      {
        key?: string(name='Key', description='The field name. This operation supports all fields. For details, see the **Supported field names** section below.', example='matched_host'),
        opValue?: string(name='OpValue', description='The operator. For details, see the **Supported operators** section below.', example='eq'),
        values?: any(name='Values', description='The field content.', example='test.waf-top'),
      }
    ](name='Conditions', description='The filter conditions. Each object describes a filter condition.'),
    dateRange?: {
      endDate?: long(name='EndDate', description='The end of the time range to query. The value is a Unix timestamp. Unit: seconds.

This parameter is required.', example='1713888600'),
      startDate?: long(name='StartDate', description='The beginning of the time range to query. The value is a Unix timestamp. Unit: seconds.

This parameter is required.', example='1713888000'),
    }(name='DateRange', description='The time range for the query.

This parameter is required.'),
  }(name='Filter', description='The filter conditions for the query. Multiple conditions are evaluated by using a logical AND.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  metric?: string(name='Metric', description='The metric whose time series data you want to return. The following metrics are supported:

*   mitigated_requests: The system returns the time series data of requests that are blocked.
*   monitored_requests: The system returns the time series data of requests that match Monitor protection rules.
*   mitigated_requests_group_by_defense_scene: The system returns the number of requests that match each protection module. The returned results are grouped by protection module and can be used to generate time series charts. A request can match multiple protection modules. Therefore, the total number of matched requests is inconsistent with the total number of requests.
*   mitigated_requests_group_by_block_defense_scene: The system returns the number of requests that are blocked by each protection module. The returned results are grouped by protection module and can be used to generate time series charts. A request can be blocked by only one protection module. Therefore, the total number of blocked requests is consistent with the total number of requests.

This parameter is required.', example='mitigated_requests'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeSecurityEventTimeSeriesMetricShrinkRequest {
  filterShrink?: string(name='Filter', description='The filter conditions for the query. Multiple conditions are evaluated by using a logical AND.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  metric?: string(name='Metric', description='The metric whose time series data you want to return. The following metrics are supported:

*   mitigated_requests: The system returns the time series data of requests that are blocked.
*   monitored_requests: The system returns the time series data of requests that match Monitor protection rules.
*   mitigated_requests_group_by_defense_scene: The system returns the number of requests that match each protection module. The returned results are grouped by protection module and can be used to generate time series charts. A request can match multiple protection modules. Therefore, the total number of matched requests is inconsistent with the total number of requests.
*   mitigated_requests_group_by_block_defense_scene: The system returns the number of requests that are blocked by each protection module. The returned results are grouped by protection module and can be used to generate time series charts. A request can be blocked by only one protection module. Therefore, the total number of blocked requests is consistent with the total number of requests.

This parameter is required.', example='mitigated_requests'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeSecurityEventTimeSeriesMetricResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D827FCFE-90A7-4330-9326-*****4C7726'),
  securityEventTimeSeries?: [ 
    {
      metric?: string(name='Metric', description='The metric. This value is the same as the value of Metric in the request parameters.', example='monitored_requests'),
      timestamps?: [ string ](name='Timestamps', description='The time points. Each point represents a time range.'),
      values?: [ long ](name='Values', description='The data points. Each point represents a count for a time range.'),
    }
  ](name='SecurityEventTimeSeries', description='The time series data returned. This operation can return time series for multiple metrics.'),
  timeSeriesMetaData?: {
    aggregateInterval?: string(name='AggregateInterval', description='The time granularity of data points in the time series data returned. For example, a value of 15m indicates that data points are collected at 15-minute intervals. For more information about time granularities, see the **Time granularities of data points in time series** section below.', example='1m'),
    dateRange?: {
      endDate?: long(name='EndDate', description='The end of the time range to query. The value is a Unix timestamp. Unit: seconds. This value is the same as the value of EndDate in the request parameters.', example='1713888600'),
      startDate?: long(name='StartDate', description='The beginning of the time range to query. The value is a Unix timestamp. Unit: seconds. This value is the same as the value of StartDate in the request parameters.', example='1713888000'),
    }(name='DateRange', description='The time range that is used for the query.'),
    units?: string(name='Units', description='The unit of the statistics returned. It is fixed as requests.', example='requests'),
  }(name='TimeSeriesMetaData', description='The metadata of the time series data returned.'),
}

model DescribeSecurityEventTimeSeriesMetricResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSecurityEventTimeSeriesMetricResponseBody(name='body'),
}

/**
 * @summary Queries the time series data of attack traffic. Attack requests refer to requests that match protection rules and are identified as risky.
 *
 * @description Attack traffic refers to the traffic of requests that match protection rules and are identified as risky. The following types of requests are excluded:
 * *   Requests that match the protection rules of the whitelist module.
 * *   Requests that match the protection rules of the bot management module. The actions of the protection rules are set to Add Tag.
 * *   Requests that match protection rules with actions set to Dynamic Token-based Authentication, Slider CAPTCHA, Strict Slider CAPTCHA Verification, and JavaScript Validation, pass the verifications specified by the actions, and are allowed.
 *
 * @param tmpReq DescribeSecurityEventTimeSeriesMetricRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSecurityEventTimeSeriesMetricResponse
 */
async function describeSecurityEventTimeSeriesMetricWithOptions(tmpReq: DescribeSecurityEventTimeSeriesMetricRequest, runtime: $RuntimeOptions): DescribeSecurityEventTimeSeriesMetricResponse {
  tmpReq.validate();
  var request = new DescribeSecurityEventTimeSeriesMetricShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'Filter', 'json');
  }
  var query = {};
  if (!$isNull(request.filterShrink)) {
    query['Filter'] = request.filterShrink;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.metric)) {
    query['Metric'] = request.metric;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSecurityEventTimeSeriesMetric',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the time series data of attack traffic. Attack requests refer to requests that match protection rules and are identified as risky.
 *
 * @description Attack traffic refers to the traffic of requests that match protection rules and are identified as risky. The following types of requests are excluded:
 * *   Requests that match the protection rules of the whitelist module.
 * *   Requests that match the protection rules of the bot management module. The actions of the protection rules are set to Add Tag.
 * *   Requests that match protection rules with actions set to Dynamic Token-based Authentication, Slider CAPTCHA, Strict Slider CAPTCHA Verification, and JavaScript Validation, pass the verifications specified by the actions, and are allowed.
 *
 * @param request DescribeSecurityEventTimeSeriesMetricRequest
 * @return DescribeSecurityEventTimeSeriesMetricResponse
 */
async function describeSecurityEventTimeSeriesMetric(request: DescribeSecurityEventTimeSeriesMetricRequest): DescribeSecurityEventTimeSeriesMetricResponse {
  var runtime = new $RuntimeOptions{};
  return describeSecurityEventTimeSeriesMetricWithOptions(request, runtime);
}

model DescribeSecurityEventTopNMetricRequest {
  filter?: {
    conditions?: [ 
      {
        key?: string(name='Key', description='The field name. This operation supports all fields. For more information, see the **Supported field names** section below.', example='matched_host'),
        opValue?: string(name='OpValue', description='The operator. For more information, see the **Supported operators** section below.', example='eq'),
        values?: any(name='Values', description='The field content.', example='test.waf-top'),
      }
    ](name='Conditions', description='The filter conditions. Each object describes a filter condition.'),
    dateRange?: {
      endDate?: long(name='EndDate', description='The end of the time range to query. The value is a Unix timestamp. Unit: seconds.

This parameter is required.', example='1713888600'),
      startDate?: long(name='StartDate', description='The beginning of the time range to query. The value is a Unix timestamp. Unit: seconds.

This parameter is required.', example='1713888000'),
    }(name='DateRange', description='The time range for the query.

This parameter is required.'),
  }(name='Filter', description='The filter conditions for the query. Multiple conditions are evaluated by using a logical AND.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  limit?: long(name='Limit', description='The number of data entries that can be returned. Data entries are sorted in descending order before they are returned. Maximum value: 10.

This parameter is required.', example='10'),
  metric?: string(name='Metric', description='The metric whose top N data entries you want to return. The following metrics are supported:

>  For more information about attack requests, see the "Operation description" section of this topic.

*   real_client_ip: The system aggregates the source IP addresses of attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   http_user_agent: The system aggregates the User-Agent header field of attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   matched_host: The system aggregates the protected objects that are matched by attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   remote_region_id: The system aggregates the countries to which the source IP addresses of attack requests belong to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   request_path: The system aggregates the URLs of attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries. The URLs exclude query strings.
*   block_defense_scene: The system aggregates the protection modules that block attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries. The requests match protection rules whose actions are not set to Monitor.
*   defense_scene: The system aggregates the protection modules that are matched by attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   defense_scene_rule_id: The system returns the IDs of top N protection rules that are matched by attack requests and also the related protection modules. Only protection rules whose actions are not set to Monitor are counted. The system returns the value in the following format:\\\\
    `{ "Attribute": "waf_base", "Value": 140, "Name": "111034" }`
*   defense_scene_with_rule_id: The system returns the IDs of top N protection rules that are matched by attack requests and also the related protection modules. The IDs and protection modules are connected by using hyphens (-). Protection rules whose actions are set to Monitor and Block are counted. The system returns the value in the following format:\\\\
    `{ "Attribute": "", "Value": 1, "Name": "120075-waf_base" }`
*   defense_scene_top_rule_id: The system returns top N matched protection rules of a specific protection module. You can specify Conditions in Filter to configure filter conditions. For example, you can use the following condition to query top N matched protection rules of the custom rule module:\\\\
    `{ "Key": "defense_scene_map", "OpValue": "contain", "Values": "custom_acl" }`
*   defense_scene_rule_type: The system returns top N matched protection rules of the core web protection module. This metric is supported only by the core web protection module because only this module supports subtypes of protection rules. You must specify Conditions in Filter to configure filter conditions. Example:\\\\
    `{ "Key": "defense_scene", "OpValue": "eq", "Values": "waf_base" }`

This parameter is required.', example='real_client_ip'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeSecurityEventTopNMetricShrinkRequest {
  filterShrink?: string(name='Filter', description='The filter conditions for the query. Multiple conditions are evaluated by using a logical AND.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  limit?: long(name='Limit', description='The number of data entries that can be returned. Data entries are sorted in descending order before they are returned. Maximum value: 10.

This parameter is required.', example='10'),
  metric?: string(name='Metric', description='The metric whose top N data entries you want to return. The following metrics are supported:

>  For more information about attack requests, see the "Operation description" section of this topic.

*   real_client_ip: The system aggregates the source IP addresses of attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   http_user_agent: The system aggregates the User-Agent header field of attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   matched_host: The system aggregates the protected objects that are matched by attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   remote_region_id: The system aggregates the countries to which the source IP addresses of attack requests belong to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   request_path: The system aggregates the URLs of attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries. The URLs exclude query strings.
*   block_defense_scene: The system aggregates the protection modules that block attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries. The requests match protection rules whose actions are not set to Monitor.
*   defense_scene: The system aggregates the protection modules that are matched by attack requests to collect statistics, sorts the statistical results in descending order, and returns top N data entries.
*   defense_scene_rule_id: The system returns the IDs of top N protection rules that are matched by attack requests and also the related protection modules. Only protection rules whose actions are not set to Monitor are counted. The system returns the value in the following format:\\\\
    `{ "Attribute": "waf_base", "Value": 140, "Name": "111034" }`
*   defense_scene_with_rule_id: The system returns the IDs of top N protection rules that are matched by attack requests and also the related protection modules. The IDs and protection modules are connected by using hyphens (-). Protection rules whose actions are set to Monitor and Block are counted. The system returns the value in the following format:\\\\
    `{ "Attribute": "", "Value": 1, "Name": "120075-waf_base" }`
*   defense_scene_top_rule_id: The system returns top N matched protection rules of a specific protection module. You can specify Conditions in Filter to configure filter conditions. For example, you can use the following condition to query top N matched protection rules of the custom rule module:\\\\
    `{ "Key": "defense_scene_map", "OpValue": "contain", "Values": "custom_acl" }`
*   defense_scene_rule_type: The system returns top N matched protection rules of the core web protection module. This metric is supported only by the core web protection module because only this module supports subtypes of protection rules. You must specify Conditions in Filter to configure filter conditions. Example:\\\\
    `{ "Key": "defense_scene", "OpValue": "eq", "Values": "waf_base" }`

This parameter is required.', example='real_client_ip'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: The Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='ap-southeast-1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeSecurityEventTopNMetricResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D827FCFE-90A7-4330-9326-*****B4C7726'),
  securityEventTopNValues?: [ 
    {
      attribute?: string(name='Attribute', description='The additional information, such as the protection module for a protection rule whose ID is returned.', example='waf_base'),
      name?: string(name='Name', description='The field value, which varies based on the metric.', example='10000'),
      value?: long(name='Value', description='The count for the data entry.', example='1111'),
    }
  ](name='SecurityEventTopNValues', description='The top N data entries returned.'),
  topNMetaData?: {
    dateRange?: {
      endDate?: long(name='EndDate', description='The end of the time range to query. The value is a Unix timestamp. Unit: seconds. This value is the same as the value of EndDate in the request parameters.', example='1713888600'),
      startDate?: long(name='StartDate', description='The beginning of the time range to query. The value is a Unix timestamp. Unit: seconds. This value is the same as the value of StartDate in the request parameters.', example='1713888000'),
    }(name='DateRange', description='The time range that is used for the query.'),
    units?: string(name='Units', description='The unit of the statistics returned. It is fixed as requests.', example='requests'),
  }(name='TopNMetaData', description='The metadata of the data entries returned.'),
}

model DescribeSecurityEventTopNMetricResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSecurityEventTopNMetricResponseBody(name='body'),
}

/**
 * @summary Queries top N data entries of attack traffic. The system performs statistical aggregation on attack traffic from specific dimensions and returns top N data entries.
 *
 * @description Attack traffic refers to the traffic of requests that match protection rules and are identified as risky. The following types of requests are excluded:
 * *   Requests that match the protection rules of the whitelist module.
 * *   Requests that match the protection rules of the bot management module. The actions of the protection rules are set to Add Tag.
 * *   Requests that match protection rules with actions set to Dynamic Token-based Authentication, Slider CAPTCHA, Strict Slider CAPTCHA Verification, and JavaScript Validation, pass the verifications specified by the actions, and are allowed.
 *
 * @param tmpReq DescribeSecurityEventTopNMetricRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSecurityEventTopNMetricResponse
 */
async function describeSecurityEventTopNMetricWithOptions(tmpReq: DescribeSecurityEventTopNMetricRequest, runtime: $RuntimeOptions): DescribeSecurityEventTopNMetricResponse {
  tmpReq.validate();
  var request = new DescribeSecurityEventTopNMetricShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.filter)) {
    request.filterShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.filter, 'Filter', 'json');
  }
  var query = {};
  if (!$isNull(request.filterShrink)) {
    query['Filter'] = request.filterShrink;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.limit)) {
    query['Limit'] = request.limit;
  }
  if (!$isNull(request.metric)) {
    query['Metric'] = request.metric;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSecurityEventTopNMetric',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries top N data entries of attack traffic. The system performs statistical aggregation on attack traffic from specific dimensions and returns top N data entries.
 *
 * @description Attack traffic refers to the traffic of requests that match protection rules and are identified as risky. The following types of requests are excluded:
 * *   Requests that match the protection rules of the whitelist module.
 * *   Requests that match the protection rules of the bot management module. The actions of the protection rules are set to Add Tag.
 * *   Requests that match protection rules with actions set to Dynamic Token-based Authentication, Slider CAPTCHA, Strict Slider CAPTCHA Verification, and JavaScript Validation, pass the verifications specified by the actions, and are allowed.
 *
 * @param request DescribeSecurityEventTopNMetricRequest
 * @return DescribeSecurityEventTopNMetricResponse
 */
async function describeSecurityEventTopNMetric(request: DescribeSecurityEventTopNMetricRequest): DescribeSecurityEventTopNMetricResponse {
  var runtime = new $RuntimeOptions{};
  return describeSecurityEventTopNMetricWithOptions(request, runtime);
}

model DescribeSensitiveApiStatisticRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='269'),
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.

>  You can query only data of the previous month, previous 3 months, previous 6 months, previous 12 months, and data generated since January 1 of last year for compliance check. You must specify a valid time range.', example='1725966000'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  matchedHost?: string(name='MatchedHost', description='The domain name or IP address of the API.', example='a.***.com'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.

>  You can query only data of the previous month, previous 3 months, previous 6 months, previous 12 months, and data generated since January 1 of last year for compliance check. You must specify a valid time range.', example='1672502400'),
}

model DescribeSensitiveApiStatisticResponseBody = {
  data?: [ 
    {
      infoOutboundCount?: long(name='InfoOutboundCount', description='The number of personal information records involved in cross-border data transfer by domain name.', example='213'),
      list?: [ 
        {
          apiFormat?: string(name='ApiFormat', description='The API.', example='/api/login'),
          apiId?: string(name='ApiId', description='The ID of the API.', example='d288137009c119a873d4c395****'),
          infoCount?: long(name='InfoCount', description='The number of personal information records involved in cross-border data transfer by API.', example='78'),
          sensitiveCode?: [ string ](name='SensitiveCode', description='The types of sensitive data.'),
          sensitiveCount?: long(name='SensitiveCount', description='The number of sensitive personal information records involved in cross-border data transfer by API.', example='55'),
        }
      ](name='List', description='The domain name-related APIs.'),
      matchedHost?: string(name='MatchedHost', description='The domain name or IP address.', example='www.***.top'),
      sensitiveOutboundCount?: long(name='SensitiveOutboundCount', description='The number of sensitive personal information records involved in cross-border data transfer by domain name.', example='127'),
    }
  ](name='Data', description='The statistics.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model DescribeSensitiveApiStatisticResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSensitiveApiStatisticResponseBody(name='body'),
}

/**
 * @summary Queries the personal information-related APIs and domain names.
 *
 * @param request DescribeSensitiveApiStatisticRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSensitiveApiStatisticResponse
 */
async function describeSensitiveApiStatisticWithOptions(request: DescribeSensitiveApiStatisticRequest, runtime: $RuntimeOptions): DescribeSensitiveApiStatisticResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.matchedHost)) {
    query['MatchedHost'] = request.matchedHost;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSensitiveApiStatistic',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the personal information-related APIs and domain names.
 *
 * @param request DescribeSensitiveApiStatisticRequest
 * @return DescribeSensitiveApiStatisticResponse
 */
async function describeSensitiveApiStatistic(request: DescribeSensitiveApiStatisticRequest): DescribeSensitiveApiStatisticResponse {
  var runtime = new $RuntimeOptions{};
  return describeSensitiveApiStatisticWithOptions(request, runtime);
}

model DescribeSensitiveDetectionResultRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  endTime?: long(name='EndTime', description='The end of the time range to query. This value is a UNIX timestamp in UTC. Unit: seconds.', example='1725966000'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-7pp26f1****'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. This value is a UNIX timestamp in UTC. Unit: seconds.', example='1672502400'),
}

model DescribeSensitiveDetectionResultResponseBody = {
  data?: {
    result?: [ 
      {
        detectionResult?: string(name='DetectionResult', description='The compliance check results. Valid values:

*   **report**: Risks exist in cross-border data transfer.
*   **none**: No risks exist in cross-border data transfer.', example='report'),
        list?: [ 
          {
            infoCount?: long(name='InfoCount', description='The number of personal information records.', example='11'),
            outboundCount?: long(name='OutboundCount', description='The number of sensitive personal information records that are involved in cross-border data transfer.', example='6'),
            sensitiveCode?: long(name='SensitiveCode', description='The sensitive data type.', example='1002'),
          }
        ](name='List', description='The sensitive information check results by sensitive data type.'),
        max?: {
          infoCount?: long(name='InfoCount', description='The number of sensitive personal information records that are of the most frequent sensitive data type.', example='187'),
          outboundCount?: long(name='OutboundCount', description='The number of sensitive personal information records that are of the most frequent sensitive data type and are involved in cross-border data transfer.', example='54'),
          sensitiveCode?: long(name='SensitiveCode', description='The most frequent sensitive data type.', example='1003'),
        }(name='Max', description='The maximum values in the statistics of sensitive data types.'),
      }
    ](name='Result', description='The compliance checks.'),
  }(name='Data', description='The compliance check results.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DescribeSensitiveDetectionResultResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSensitiveDetectionResultResponseBody(name='body'),
}

/**
 * @summary Queries the compliance check results of API security.
 *
 * @param request DescribeSensitiveDetectionResultRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSensitiveDetectionResultResponse
 */
async function describeSensitiveDetectionResultWithOptions(request: DescribeSensitiveDetectionResultRequest, runtime: $RuntimeOptions): DescribeSensitiveDetectionResultResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSensitiveDetectionResult',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the compliance check results of API security.
 *
 * @param request DescribeSensitiveDetectionResultRequest
 * @return DescribeSensitiveDetectionResultResponse
 */
async function describeSensitiveDetectionResult(request: DescribeSensitiveDetectionResultRequest): DescribeSensitiveDetectionResultResponse {
  var runtime = new $RuntimeOptions{};
  return describeSensitiveDetectionResultWithOptions(request, runtime);
}

model DescribeSensitiveOutboundDistributionRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='443'),
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.

>  You can query only data of the previous month, previous 3 months, previous 6 months, previous 12 months, and data generated since January 1 of last year for compliance check. You must specify a valid time range.', example='1725966000'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.

>  You can query only data of the previous month, previous 3 months, previous 6 months, previous 12 months, and data generated since January 1 of last year for compliance check. You must specify a valid time range.', example='1672502400'),
}

model DescribeSensitiveOutboundDistributionResponseBody = {
  data?: [ 
    {
      country?: string(name='Country', description='The country to which the data is transferred.', example='US'),
      infoOutboundCount?: long(name='InfoOutboundCount', description='The number of personal information records involved in cross-border data transfer.', example='213'),
      sensitiveOutboundCount?: long(name='SensitiveOutboundCount', description='The number of sensitive information records involved in cross-border data transfer.', example='144'),
    }
  ](name='Data', description='The traffic distribution of personal information records involved in cross-border data transfer.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model DescribeSensitiveOutboundDistributionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSensitiveOutboundDistributionResponseBody(name='body'),
}

/**
 * @summary Queries the traffic distribution of personal information records involved in cross-border data transfer.
 *
 * @param request DescribeSensitiveOutboundDistributionRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSensitiveOutboundDistributionResponse
 */
async function describeSensitiveOutboundDistributionWithOptions(request: DescribeSensitiveOutboundDistributionRequest, runtime: $RuntimeOptions): DescribeSensitiveOutboundDistributionResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSensitiveOutboundDistribution',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the traffic distribution of personal information records involved in cross-border data transfer.
 *
 * @param request DescribeSensitiveOutboundDistributionRequest
 * @return DescribeSensitiveOutboundDistributionResponse
 */
async function describeSensitiveOutboundDistribution(request: DescribeSensitiveOutboundDistributionRequest): DescribeSensitiveOutboundDistributionResponse {
  var runtime = new $RuntimeOptions{};
  return describeSensitiveOutboundDistributionWithOptions(request, runtime);
}

model DescribeSensitiveOutboundStatisticRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  detectionResult?: string(name='DetectionResult', description='The evaluation result. Valid values:

*   **report**: Risks exist in cross-border data transfer.
*   **none**: No risks exist in cross-border data transfer.', example='report'),
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.

>  You can query only data of the previous month, previous 3 months, previous 6 months, previous 12 months, and data generated since January 1 of last year for compliance check. You must specify a valid time range.', example='1725966000'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-0xldbqt****'),
  orderKey?: string(name='OrderKey', description='The name of the sorting field. Valid values:

*   **total_count** (default): total number of data entries
*   **outbound_count**: total number of data entries that are transferred across borders', example='total_count'),
  orderWay?: string(name='OrderWay', description='The sorting method. Valid values:

*   **desc** (default): in descending order
*   **asc**: in ascending order', example='desc'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  sensitiveCode?: string(name='SensitiveCode', description='The type of the sensitive data. Separate multiple types with commas (,).

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of sensitive data. Only built-in types of sensitive data are supported for this operation.', example='1000,1001'),
  sensitiveLevel?: string(name='SensitiveLevel', description='The sensitivity level. Valid values:

*   **high**
*   **medium**
*   **low**', example='high'),
  sensitiveType?: string(name='SensitiveType', description='The type of the information. Valid values:

*   **info** (default): full personal information
*   **sensitive**: sensitive personal information', example='info'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.

>  You can query only data of the previous month, previous 3 months, previous 6 months, previous 12 months, and data generated since January 1 of last year for compliance check. You must specify a valid time range.', example='1672502400'),
}

model DescribeSensitiveOutboundStatisticResponseBody = {
  data?: [ 
    {
      detectionResult?: string(name='DetectionResult', description='The evaluation result. Valid values:

*   **report**: Risks exist in cross-border data transfer.
*   **none**: No risks exist in cross-border data transfer.', example='report'),
      infoCount?: long(name='InfoCount', description='The total number of entries returned.', example='546'),
      outboundCount?: long(name='OutboundCount', description='The number of data entries that are transferred across borders.', example='300'),
      sensitiveCode?: long(name='SensitiveCode', description='The type of the sensitive data.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of sensitive data.', example='1001'),
      sensitiveLevel?: string(name='SensitiveLevel', description='The sensitivity level. Valid values:

*   **high**
*   **medium**
*   **low**', example='high'),
      sensitiveType?: string(name='SensitiveType', description='The type of the information. Valid values:

*   **info**: full personal information
*   **sensitive**: sensitive personal information', example='info'),
    }
  ](name='Data', description='The data types of personal information involved in cross-border data transfer.'),
  requestId?: string(name='RequestId', description='The request ID.', example='2EFCFE18-78F8-5079-B312-07***48B'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='5'),
}

model DescribeSensitiveOutboundStatisticResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSensitiveOutboundStatisticResponseBody(name='body'),
}

/**
 * @summary Queries the data types of personal information involved in cross-border data transfer.
 *
 * @param request DescribeSensitiveOutboundStatisticRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSensitiveOutboundStatisticResponse
 */
async function describeSensitiveOutboundStatisticWithOptions(request: DescribeSensitiveOutboundStatisticRequest, runtime: $RuntimeOptions): DescribeSensitiveOutboundStatisticResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.detectionResult)) {
    query['DetectionResult'] = request.detectionResult;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.orderKey)) {
    query['OrderKey'] = request.orderKey;
  }
  if (!$isNull(request.orderWay)) {
    query['OrderWay'] = request.orderWay;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.sensitiveCode)) {
    query['SensitiveCode'] = request.sensitiveCode;
  }
  if (!$isNull(request.sensitiveLevel)) {
    query['SensitiveLevel'] = request.sensitiveLevel;
  }
  if (!$isNull(request.sensitiveType)) {
    query['SensitiveType'] = request.sensitiveType;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSensitiveOutboundStatistic',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the data types of personal information involved in cross-border data transfer.
 *
 * @param request DescribeSensitiveOutboundStatisticRequest
 * @return DescribeSensitiveOutboundStatisticResponse
 */
async function describeSensitiveOutboundStatistic(request: DescribeSensitiveOutboundStatisticRequest): DescribeSensitiveOutboundStatisticResponse {
  var runtime = new $RuntimeOptions{};
  return describeSensitiveOutboundStatisticWithOptions(request, runtime);
}

model DescribeSensitiveOutboundTrendRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='433'),
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.

>  You can query only data of the previous month, previous 3 months, previous 6 months, previous 12 months, and data generated since January 1 of last year for compliance check. You must specify a valid time range.', example='1725966000'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.

>  You can query only data of the previous month, previous 3 months, previous 6 months, previous 12 months, and data generated since January 1 of last year for compliance check. You must specify a valid time range.', example='1672502400'),
}

model DescribeSensitiveOutboundTrendResponseBody = {
  data?: [ 
    {
      infoCount?: long(name='InfoCount', description='The total number of personal information records.', example='672'),
      infoOutboundCount?: long(name='InfoOutboundCount', description='The total number of personal information records involved in cross-border data transfer.', example='541'),
      sensitiveOutboundCount?: long(name='SensitiveOutboundCount', description='The total number of sensitive information records involved in cross-border data transfer.', example='378'),
      timestamp?: long(name='Timestamp', description='The time of cross-border data transfer. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1672502400'),
    }
  ](name='Data', description='The information records involved in cross-border data transfer.'),
  requestId?: string(name='RequestId', description='The request ID.', example='C1823E96-EF4B-5BD2-9E02-1D18****3ED8'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='7'),
}

model DescribeSensitiveOutboundTrendResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSensitiveOutboundTrendResponseBody(name='body'),
}

/**
 * @summary Queries the trends of cross-border data transfer of personal information.
 *
 * @param request DescribeSensitiveOutboundTrendRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSensitiveOutboundTrendResponse
 */
async function describeSensitiveOutboundTrendWithOptions(request: DescribeSensitiveOutboundTrendRequest, runtime: $RuntimeOptions): DescribeSensitiveOutboundTrendResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSensitiveOutboundTrend',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the trends of cross-border data transfer of personal information.
 *
 * @param request DescribeSensitiveOutboundTrendRequest
 * @return DescribeSensitiveOutboundTrendResponse
 */
async function describeSensitiveOutboundTrend(request: DescribeSensitiveOutboundTrendRequest): DescribeSensitiveOutboundTrendResponse {
  var runtime = new $RuntimeOptions{};
  return describeSensitiveOutboundTrendWithOptions(request, runtime);
}

model DescribeSensitiveRequestLogRequest {
  apiFormat?: string(name='ApiFormat', description='The API.', example='/api/users/login'),
  clientIP?: string(name='ClientIP', description='The IP address.', example='103.118.55.**'),
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='433'),
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1726057800'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  matchedHost?: string(name='MatchedHost', description='The domain name of the API.', example='a.***.com'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  sensitiveCode?: string(name='SensitiveCode', description='The type of the sensitive data.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of sensitive data.', example='1000,1001'),
  sensitiveData?: string(name='SensitiveData', description='The response sensitive data.', example='user'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1723392000'),
}

model DescribeSensitiveRequestLogResponseBody = {
  data?: [ 
    {
      apiFormat?: string(name='ApiFormat', description='The API.', example='/api/users/login'),
      apiId?: string(name='ApiId', description='The ID of the API.', example='197b52abcd81d6a8bd4***e477'),
      clientIP?: string(name='ClientIP', description='The IP address.', example='103.118.55.**'),
      count?: long(name='Count', description='The number of sensitive data records involved in cross-border data transfer.', example='12'),
      matchedHost?: string(name='MatchedHost', description='The domain name of the API.', example='a.****.com'),
      remoteCountryId?: string(name='RemoteCountryId', description='IP region, formatted as a region code.', example='CN'),
      requestTime?: long(name='RequestTime', description='The time when the request was initiated. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1723392000'),
      sensitiveList?: string(name='SensitiveList', description='The details of sensitive data. The value is a string that consists of a JSON struct. The JSON struct contains key-value pairs. In a key-value pair, a key indicates the identifier of a sensitive data type, including built-in and custom types, and a value indicates specific sensitive data.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported sensitive data types.', example='{
          "1000":[ 
              "90.88.49.19",
              "90.88.49.19"
          ],
          "835436":[ 
              "www.abc.com"
          ]
}'),
      traceId?: string(name='TraceId', description='The trace ID.', example='0a3d455b17027784870843933dce3d'),
    }
  ](name='Data', description='The access logs.'),
  requestId?: string(name='RequestId', description='The request ID.', example='26E46541-7AAB-5565-801D-F14DBDC5****'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='7'),
}

model DescribeSensitiveRequestLogResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSensitiveRequestLogResponseBody(name='body'),
}

/**
 * @summary Queries the access logs of sensitive data.
 *
 * @param request DescribeSensitiveRequestLogRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSensitiveRequestLogResponse
 */
async function describeSensitiveRequestLogWithOptions(request: DescribeSensitiveRequestLogRequest, runtime: $RuntimeOptions): DescribeSensitiveRequestLogResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.apiFormat)) {
    query['ApiFormat'] = request.apiFormat;
  }
  if (!$isNull(request.clientIP)) {
    query['ClientIP'] = request.clientIP;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.matchedHost)) {
    query['MatchedHost'] = request.matchedHost;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.sensitiveCode)) {
    query['SensitiveCode'] = request.sensitiveCode;
  }
  if (!$isNull(request.sensitiveData)) {
    query['SensitiveData'] = request.sensitiveData;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSensitiveRequestLog',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the access logs of sensitive data.
 *
 * @param request DescribeSensitiveRequestLogRequest
 * @return DescribeSensitiveRequestLogResponse
 */
async function describeSensitiveRequestLog(request: DescribeSensitiveRequestLogRequest): DescribeSensitiveRequestLogResponse {
  var runtime = new $RuntimeOptions{};
  return describeSensitiveRequestLogWithOptions(request, runtime);
}

model DescribeSensitiveRequestsRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='269'),
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1725966000'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-0xldbqt****'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: 10.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekzwwkpn****5i'),
  sensitiveCode?: long(name='SensitiveCode', description='The type of the sensitive data.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of sensitive data.', example='1001'),
  sensitiveData?: string(name='SensitiveData', description='The sensitive data.', example='card'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1723392000'),
}

model DescribeSensitiveRequestsResponseBody = {
  data?: [ 
    {
      abnormalCount?: long(name='AbnormalCount', description='The number of risks in the previous 30 days.', example='23'),
      apiFormat?: string(name='ApiFormat', description='The API.', example='/api/users/login'),
      apiId?: string(name='ApiId', description='The ID of the API.', example='09559c0d71ca2ffc996b81***836d8'),
      clientIP?: string(name='ClientIP', description='The IP address.', example='103.118.55.**'),
      detectionResult?: string(name='DetectionResult', description='The evaluation result. Valid values:

*   **leak**: Data leaks may occur.
*   **none**: No data leak can occur.', example='leak'),
      eventCount?: long(name='EventCount', description='The number of events in the previous 30 days.', example='679'),
      infoCount?: [ 
        {
          code?: string(name='Code', description='The type of the sensitive data.', example='1001'),
          count?: long(name='Count', description='The number of sensitive data entries.', example='23'),
        }
      ](name='InfoCount', description='The statistics of the sensitive data.'),
      matchedHost?: string(name='MatchedHost', description='The domain name of the API.', example='a.****.com'),
      sensitiveList?: [ string ](name='SensitiveList', description='The sensitive data.'),
    }
  ](name='Data', description='The tracing results of the data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='26E46541-7AAB-5565-801D-F14DBDC5****'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model DescribeSensitiveRequestsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSensitiveRequestsResponseBody(name='body'),
}

/**
 * @summary Queries the tracing results of sensitive data.
 *
 * @param request DescribeSensitiveRequestsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSensitiveRequestsResponse
 */
async function describeSensitiveRequestsWithOptions(request: DescribeSensitiveRequestsRequest, runtime: $RuntimeOptions): DescribeSensitiveRequestsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.sensitiveCode)) {
    query['SensitiveCode'] = request.sensitiveCode;
  }
  if (!$isNull(request.sensitiveData)) {
    query['SensitiveData'] = request.sensitiveData;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSensitiveRequests',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the tracing results of sensitive data.
 *
 * @param request DescribeSensitiveRequestsRequest
 * @return DescribeSensitiveRequestsResponse
 */
async function describeSensitiveRequests(request: DescribeSensitiveRequestsRequest): DescribeSensitiveRequestsResponse {
  var runtime = new $RuntimeOptions{};
  return describeSensitiveRequestsWithOptions(request, runtime);
}

model DescribeSensitiveStatisticRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1725966000'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_elasticity-cn-0xldbq****'),
  pageNumber?: long(name='PageNumber', description='The page number. Default value: **1**.', example='1'),
  pageSize?: long(name='PageSize', description='The number of entries per page. Default value: **10**.', example='10'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1672502400'),
  statisticType?: string(name='StatisticType', description='The type of the statistics. Valid values:

*   **ip**: IP address
*   **host**: domain name
*   **sensitive_code**: sensitive data type
*   **api**: sensitive data-related API', example='ip'),
}

model DescribeSensitiveStatisticResponseBody = {
  data?: [ 
    {
      apiFormat?: string(name='ApiFormat', description='The API.', example='/api/login'),
      clientIP?: string(name='ClientIP', description='The IP address.', example='10.50.11.**'),
      count?: long(name='Count', description='The number of entries returned.', example='169'),
      matchedHost?: string(name='MatchedHost', description='The domain name.', example='a.****.com'),
      sensitiveCode?: string(name='SensitiveCode', description='The type of the sensitive data.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of sensitive data.', example='1003'),
    }
  ](name='Data', description='The statistics of the sensitive data.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
  totalCount?: long(name='TotalCount', description='The total number of entries returned.', example='10'),
}

model DescribeSensitiveStatisticResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSensitiveStatisticResponseBody(name='body'),
}

/**
 * @summary Queries the sensitive data statistics of the tracing and auditing feature.
 *
 * @param request DescribeSensitiveStatisticRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSensitiveStatisticResponse
 */
async function describeSensitiveStatisticWithOptions(request: DescribeSensitiveStatisticRequest, runtime: $RuntimeOptions): DescribeSensitiveStatisticResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pageNumber)) {
    query['PageNumber'] = request.pageNumber;
  }
  if (!$isNull(request.pageSize)) {
    query['PageSize'] = request.pageSize;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  if (!$isNull(request.statisticType)) {
    query['StatisticType'] = request.statisticType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSensitiveStatistic',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the sensitive data statistics of the tracing and auditing feature.
 *
 * @param request DescribeSensitiveStatisticRequest
 * @return DescribeSensitiveStatisticResponse
 */
async function describeSensitiveStatistic(request: DescribeSensitiveStatisticRequest): DescribeSensitiveStatisticResponse {
  var runtime = new $RuntimeOptions{};
  return describeSensitiveStatisticWithOptions(request, runtime);
}

model DescribeSlsAuthStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-g4t3g****04'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aek2okfav****iq'),
}

model DescribeSlsAuthStatusResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='3589D3A3-4A04-51CB-AA89-353ED20A****'),
  status?: boolean(name='Status', description='Indicates whether WAF is authorized to access Logstores. Valid values:

*   **true**
*   **false**', example='false'),
}

model DescribeSlsAuthStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSlsAuthStatusResponseBody(name='body'),
}

/**
 * @summary Queries whether Web Application Firewall (WAF) is authorized to access Logstores.
 *
 * @param request DescribeSlsAuthStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSlsAuthStatusResponse
 */
async function describeSlsAuthStatusWithOptions(request: DescribeSlsAuthStatusRequest, runtime: $RuntimeOptions): DescribeSlsAuthStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSlsAuthStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries whether Web Application Firewall (WAF) is authorized to access Logstores.
 *
 * @param request DescribeSlsAuthStatusRequest
 * @return DescribeSlsAuthStatusResponse
 */
async function describeSlsAuthStatus(request: DescribeSlsAuthStatusRequest): DescribeSlsAuthStatusResponse {
  var runtime = new $RuntimeOptions{};
  return describeSlsAuthStatusWithOptions(request, runtime);
}

model DescribeSlsLogStoreRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-zpr3d****0o'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aek2wf3mn****vq'),
}

model DescribeSlsLogStoreResponseBody = {
  logStoreName?: string(name='LogStoreName', description='The name of the Logstore.', example='wafng-logstore'),
  projectName?: string(name='ProjectName', description='The name of the Simple Log Service project.', example='wafng-project-14316572********-cn-hangzhou'),
  quota?: long(name='Quota', description='The capacity of the Logstore. Unit: bytes.', example='3298534883328'),
  requestId?: string(name='RequestId', description='The request ID.', example='CAC0A24B-486A-5E12-9894-BE860E5F****'),
  ttl?: int32(name='Ttl', description='The storage duration of the Logstore. Unit: days.', example='180'),
  used?: long(name='Used', description='The used capacity of the Logstore. Unit: bytes.', example='35471136'),
}

model DescribeSlsLogStoreResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSlsLogStoreResponseBody(name='body'),
}

/**
 * @summary Queries information about a Logstore, such as the total capacity, storage duration, and used capacity.
 *
 * @param request DescribeSlsLogStoreRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSlsLogStoreResponse
 */
async function describeSlsLogStoreWithOptions(request: DescribeSlsLogStoreRequest, runtime: $RuntimeOptions): DescribeSlsLogStoreResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSlsLogStore',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries information about a Logstore, such as the total capacity, storage duration, and used capacity.
 *
 * @param request DescribeSlsLogStoreRequest
 * @return DescribeSlsLogStoreResponse
 */
async function describeSlsLogStore(request: DescribeSlsLogStoreRequest): DescribeSlsLogStoreResponse {
  var runtime = new $RuntimeOptions{};
  return describeSlsLogStoreWithOptions(request, runtime);
}

model DescribeSlsLogStoreStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-uqm35****02'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfmzedqv****ma'),
}

model DescribeSlsLogStoreStatusResponseBody = {
  existStatus?: boolean(name='ExistStatus', description='Indicates whether a Logstore is created for WAF. Valid values:

*   **true**
*   **false**', example='true'),
  requestId?: string(name='RequestId', description='The request ID.', example='184F538F-C115-5C89-A4EF-C79CD2E29AC7'),
}

model DescribeSlsLogStoreStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSlsLogStoreStatusResponseBody(name='body'),
}

/**
 * @summary Queries the status of a Simple Log Service Logstore.
 *
 * @param request DescribeSlsLogStoreStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSlsLogStoreStatusResponse
 */
async function describeSlsLogStoreStatusWithOptions(request: DescribeSlsLogStoreStatusRequest, runtime: $RuntimeOptions): DescribeSlsLogStoreStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeSlsLogStoreStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the status of a Simple Log Service Logstore.
 *
 * @param request DescribeSlsLogStoreStatusRequest
 * @return DescribeSlsLogStoreStatusResponse
 */
async function describeSlsLogStoreStatus(request: DescribeSlsLogStoreStatusRequest): DescribeSlsLogStoreStatusResponse {
  var runtime = new $RuntimeOptions{};
  return describeSlsLogStoreStatusWithOptions(request, runtime);
}

model DescribeTemplateResourceCountRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-lbj****gx08'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekzwwkpn****5i'),
  templateIds?: string(name='TemplateIds', description='The IDs of the protection templates that you want to query. Separate multiple template IDs with commas (,).

This parameter is required.', example='12345,12346'),
}

model DescribeTemplateResourceCountResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='B8064433-9781-5E86-806E-C1DD****1D95'),
  resourceCount?: [ 
    {
      groupCount?: int32(name='GroupCount', description='The number of protected object groups.', example='30'),
      singleCount?: int32(name='SingleCount', description='The number of protected objects.', example='30'),
      templateId?: long(name='TemplateId', description='The ID of the protection template.', example='12345'),
    }
  ](name='ResourceCount', description='The number of protected objects or protected object groups for which the protection template takes effect.'),
}

model DescribeTemplateResourceCountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeTemplateResourceCountResponseBody(name='body'),
}

/**
 * @summary Queries the number of protected resources for which a protection template takes effect.
 *
 * @param request DescribeTemplateResourceCountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeTemplateResourceCountResponse
 */
async function describeTemplateResourceCountWithOptions(request: DescribeTemplateResourceCountRequest, runtime: $RuntimeOptions): DescribeTemplateResourceCountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateIds)) {
    query['TemplateIds'] = request.templateIds;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeTemplateResourceCount',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the number of protected resources for which a protection template takes effect.
 *
 * @param request DescribeTemplateResourceCountRequest
 * @return DescribeTemplateResourceCountResponse
 */
async function describeTemplateResourceCount(request: DescribeTemplateResourceCountRequest): DescribeTemplateResourceCountResponse {
  var runtime = new $RuntimeOptions{};
  return describeTemplateResourceCountWithOptions(request, runtime);
}

model DescribeTemplateResourcesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  resourceType?: string(name='ResourceType', description='The type of the protected resource. Valid values:

*   **single:** protected object.
*   **group:** protected object group.

This parameter is required.', example='single'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template.

This parameter is required.', example='1020'),
}

model DescribeTemplateResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='C7BC9373-3960-53B0-8968-2B13454AE18F'),
  resources?: [ string ](name='Resources', description='An array of protected objects or protected object groups that are associated to the protection rule template.'),
}

model DescribeTemplateResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeTemplateResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the resources that are associated to a protection rule template.
 *
 * @param request DescribeTemplateResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeTemplateResourcesResponse
 */
async function describeTemplateResourcesWithOptions(request: DescribeTemplateResourcesRequest, runtime: $RuntimeOptions): DescribeTemplateResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeTemplateResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the resources that are associated to a protection rule template.
 *
 * @param request DescribeTemplateResourcesRequest
 * @return DescribeTemplateResourcesResponse
 */
async function describeTemplateResources(request: DescribeTemplateResourcesRequest): DescribeTemplateResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return describeTemplateResourcesWithOptions(request, runtime);
}

model DescribeUserAbnormalTrendRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-uqm342yj***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeUserAbnormalTrendResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
  trend?: [ 
    {
      abnormalHigh?: long(name='AbnormalHigh', description='The number of high risks.', example='12'),
      abnormalLow?: long(name='AbnormalLow', description='The number of low risks.', example='23'),
      abnormalMedium?: long(name='AbnormalMedium', description='The number of medium risks.', example='14'),
      timeStamp?: long(name='TimeStamp', description='The time at which the API was called. The value is a UNIX timestamp displayed in UTC. Unit: seconds.

>Notice: The parameter has been deprecated, it is recommended to use the Timestamp parameter.', example='1722268800'),
      timestamp?: long(name='Timestamp', description='The time at which the API was called. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1722268800'),
    }
  ](name='Trend', description='The trends of risks.'),
}

model DescribeUserAbnormalTrendResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserAbnormalTrendResponseBody(name='body'),
}

/**
 * @summary Queries the trends of API security risks.
 *
 * @param request DescribeUserAbnormalTrendRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserAbnormalTrendResponse
 */
async function describeUserAbnormalTrendWithOptions(request: DescribeUserAbnormalTrendRequest, runtime: $RuntimeOptions): DescribeUserAbnormalTrendResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeUserAbnormalTrend',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the trends of API security risks.
 *
 * @param request DescribeUserAbnormalTrendRequest
 * @return DescribeUserAbnormalTrendResponse
 */
async function describeUserAbnormalTrend(request: DescribeUserAbnormalTrendRequest): DescribeUserAbnormalTrendResponse {
  var runtime = new $RuntimeOptions{};
  return describeUserAbnormalTrendWithOptions(request, runtime);
}

model DescribeUserAbnormalTypeRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='993'),
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1726113600'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-g4***201'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-ac***lani'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1723435200'),
}

model DescribeUserAbnormalTypeResponseBody = {
  abnormal?: [ 
    {
      abnormalCode?: string(name='AbnormalCode', description='The code of the risk.', example='Risk_InternalWeakPasswd'),
      abnormalCount?: long(name='AbnormalCount', description='The number of risks.', example='10'),
      abnormalParentType?: string(name='AbnormalParentType', description='The parent type of the risk.', example='RiskType_Account'),
      abnormalType?: string(name='AbnormalType', description='The type of the risk.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of risks.', example='LackOfSpeedLimit'),
    }
  ](name='Abnormal', description='The types and statistics of risks.'),
  requestId?: string(name='RequestId', description='The request ID.', example='3E1CB966-1407-5988-9432-7***D784'),
}

model DescribeUserAbnormalTypeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserAbnormalTypeResponseBody(name='body'),
}

/**
 * @summary Queries the types and statistics of risks in the API security module.
 *
 * @param request DescribeUserAbnormalTypeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserAbnormalTypeResponse
 */
async function describeUserAbnormalTypeWithOptions(request: DescribeUserAbnormalTypeRequest, runtime: $RuntimeOptions): DescribeUserAbnormalTypeResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeUserAbnormalType',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the types and statistics of risks in the API security module.
 *
 * @param request DescribeUserAbnormalTypeRequest
 * @return DescribeUserAbnormalTypeResponse
 */
async function describeUserAbnormalType(request: DescribeUserAbnormalTypeRequest): DescribeUserAbnormalTypeResponse {
  var runtime = new $RuntimeOptions{};
  return describeUserAbnormalTypeWithOptions(request, runtime);
}

model DescribeUserApiRequestRequest {
  apiFormat?: string(name='ApiFormat', description='The API.
>Notice: This parameter is deprecated, please use ApiId to query.', example='/api/v1/know'),
  apiId?: string(name='ApiId', description='The ID of the API.

This parameter is required.', example='3799f0695c0d687f3295d132fe49bc14'),
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  domain?: string(name='Domain', description='The domain name or IP address of the API.
>Notice: This parameter is deprecated, please use ApiId to query.', example='c.***.com'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-zxu38***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  type?: string(name='Type', description='The type of the statistics. Valid values:

*   **api_ip**: total traffic
*   **api_cross_border_ip**: cross-border traffic
*   **api_bot_ip**: bot traffic
*   **remote_region**: geographical location
*   **client_id**: client type
*   **http_referer**: Referer
*   **api_cnt**: total number of calls
*   **bot_cnt**: number of bot calls
*   **cross_border_cnt**: number of cross-border requests
*   **api_freq**: call frequency', example='api_ip'),
}

model DescribeUserApiRequestResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D13E4540-4432-5AD7-B216-6369512514F4'),
  requests?: [ 
    {
      count?: long(name='Count', description='The number of entries returned.', example='76'),
      value?: string(name='Value', description='The type of the statistics. Valid values:

*   **client_list**: client
*   **ip**: IP address
*   **region_id** region
*   **country_id**: country', example='{
    "client_list": [
        "Unknown"
    ],
    "ip": "47.92.113.***",
    "region_id": "110000",
    "country_id": "CN"
}'),
    }
  ](name='Requests', description='The statistics.'),
}

model DescribeUserApiRequestResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserApiRequestResponseBody(name='body'),
}

/**
 * @summary Queries the traffic statistics of an API.
 *
 * @param request DescribeUserApiRequestRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserApiRequestResponse
 */
async function describeUserApiRequestWithOptions(request: DescribeUserApiRequestRequest, runtime: $RuntimeOptions): DescribeUserApiRequestResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.apiFormat)) {
    query['ApiFormat'] = request.apiFormat;
  }
  if (!$isNull(request.apiId)) {
    query['ApiId'] = request.apiId;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.type)) {
    query['Type'] = request.type;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeUserApiRequest',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the traffic statistics of an API.
 *
 * @param request DescribeUserApiRequestRequest
 * @return DescribeUserApiRequestResponse
 */
async function describeUserApiRequest(request: DescribeUserApiRequestRequest): DescribeUserApiRequestResponse {
  var runtime = new $RuntimeOptions{};
  return describeUserApiRequestWithOptions(request, runtime);
}

model DescribeUserAssetRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  dataType?: string(name='DataType', description='The type of the statistics. Valid values:

*   **asset_num**: total number of APIs
*   **asset_active**: number of active APIs
*   **asset_newborn**: number of new APIs
*   **asset_offline**: number of deactivated APIs
*   **asset_bot**: number of APIs that are called by bots
*   **asset_cross_border**: number of APIs that are called for cross-border data transfer
*   **sensitive_api**: number of response-sensitive APIs
*   **sensitive_domain**: number of response-sensitive domain names

This parameter is required.', example='asset_num'),
  days?: string(name='Days', description='The time at which the API was called. The value is a UNIX timestamp displayed in UTC. Unit: seconds.
>Notice: The parameter has been deprecated.', example='1723435200'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-uax37ijm***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeUserAssetResponseBody = {
  assets?: [ 
    {
      assetNum?: long(name='AssetNum', description='The number of APIs returned.', example='134'),
      timeStamp?: long(name='TimeStamp', description='The time at which the API was called. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1723435200'),
    }
  ](name='Assets', description='The API statistics.'),
  requestId?: string(name='RequestId', description='The request ID.', example='C1823E96-EF4B-5BD2-9E02-1D18****3ED8'),
}

model DescribeUserAssetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserAssetResponseBody(name='body'),
}

/**
 * @summary Queries the user asset statistics in the API security module.
 *
 * @param request DescribeUserAssetRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserAssetResponse
 */
async function describeUserAssetWithOptions(request: DescribeUserAssetRequest, runtime: $RuntimeOptions): DescribeUserAssetResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.dataType)) {
    query['DataType'] = request.dataType;
  }
  if (!$isNull(request.days)) {
    query['Days'] = request.days;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeUserAsset',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the user asset statistics in the API security module.
 *
 * @param request DescribeUserAssetRequest
 * @return DescribeUserAssetResponse
 */
async function describeUserAsset(request: DescribeUserAssetRequest): DescribeUserAssetResponse {
  var runtime = new $RuntimeOptions{};
  return describeUserAssetWithOptions(request, runtime);
}

model DescribeUserEventTrendRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-7mz2797x***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekzwwk****cv5i'),
}

model DescribeUserEventTrendResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='F51E6DD6-B2D2-57C9-90F1-FAFD0A19DE00'),
  trend?: [ 
    {
      eventHigh?: long(name='EventHigh', description='The number of high-risk events.', example='9'),
      eventLow?: long(name='EventLow', description='The number of low-risk events.', example='23'),
      eventMedium?: long(name='EventMedium', description='The number of medium-risk events.', example='17'),
      timeStamp?: long(name='TimeStamp', description='The time at which the API was called. The value is a UNIX timestamp displayed in UTC. Unit: seconds.
>Notice: The parameter has been deprecated, it is recommended to use the Timestamp parameter.', example='1723435200'),
      timestamp?: long(name='Timestamp', description='The time at which the API was called. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1723435200'),
    }
  ](name='Trend', description='The trends of attacks.'),
}

model DescribeUserEventTrendResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserEventTrendResponseBody(name='body'),
}

/**
 * @summary Queries the trends of attacks detected by the API security module.
 *
 * @param request DescribeUserEventTrendRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserEventTrendResponse
 */
async function describeUserEventTrendWithOptions(request: DescribeUserEventTrendRequest, runtime: $RuntimeOptions): DescribeUserEventTrendResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeUserEventTrend',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the trends of attacks detected by the API security module.
 *
 * @param request DescribeUserEventTrendRequest
 * @return DescribeUserEventTrendResponse
 */
async function describeUserEventTrend(request: DescribeUserEventTrendRequest): DescribeUserEventTrendResponse {
  var runtime = new $RuntimeOptions{};
  return describeUserEventTrendWithOptions(request, runtime);
}

model DescribeUserEventTypeRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='976'),
  endTime?: long(name='EndTime', description='The end of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1726113600'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-5y***h0t'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aek***ktt3y'),
  startTime?: long(name='StartTime', description='The beginning of the time range to query. The value is a UNIX timestamp displayed in UTC. Unit: seconds.', example='1723435200'),
}

model DescribeUserEventTypeResponseBody = {
  event?: [ 
    {
      eventCode?: string(name='EventCode', description='The code of the security event.', example='Event_LoginCollision'),
      eventCount?: long(name='EventCount', description='The number of events.', example='0'),
      eventParentType?: string(name='EventParentType', description='The parent type of the security event.', example='EventType_Account'),
      eventType?: string(name='EventType', description='The type of the security event.

>  You can call the [DescribeApisecRules](https://help.aliyun.com/document_detail/2859155.html) operation to query the supported types of security events.', example='Event_AbnormalFrequency'),
    }
  ](name='Event', description='The types and statistics of security events.'),
  requestId?: string(name='RequestId', description='The request ID.', example='177BA739-6512-5470-98C6-E***0BAA3D'),
}

model DescribeUserEventTypeResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserEventTypeResponseBody(name='body'),
}

/**
 * @summary Queries the types and statistics of security events in the API security module.
 *
 * @param request DescribeUserEventTypeRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserEventTypeResponse
 */
async function describeUserEventTypeWithOptions(request: DescribeUserEventTypeRequest, runtime: $RuntimeOptions): DescribeUserEventTypeResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.endTime)) {
    query['EndTime'] = request.endTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTime)) {
    query['StartTime'] = request.startTime;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeUserEventType',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the types and statistics of security events in the API security module.
 *
 * @param request DescribeUserEventTypeRequest
 * @return DescribeUserEventTypeResponse
 */
async function describeUserEventType(request: DescribeUserEventTypeRequest): DescribeUserEventTypeResponse {
  var runtime = new $RuntimeOptions{};
  return describeUserEventTypeWithOptions(request, runtime);
}

model DescribeUserSlsLogRegionsRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-uqm2z****0a'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou:** Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeUserSlsLogRegionsResponseBody = {
  logRegions?: [ string ](name='LogRegions', description='The region IDs.'),
  requestId?: string(name='RequestId', description='The request ID.', example='9D11AC3A-A10C-56E7-A342-E87EC892****'),
}

model DescribeUserSlsLogRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserSlsLogRegionsResponseBody(name='body'),
}

/**
 * @summary Queries available regions for log storage.
 *
 * @param request DescribeUserSlsLogRegionsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserSlsLogRegionsResponse
 */
async function describeUserSlsLogRegionsWithOptions(request: DescribeUserSlsLogRegionsRequest, runtime: $RuntimeOptions): DescribeUserSlsLogRegionsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeUserSlsLogRegions',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries available regions for log storage.
 *
 * @param request DescribeUserSlsLogRegionsRequest
 * @return DescribeUserSlsLogRegionsResponse
 */
async function describeUserSlsLogRegions(request: DescribeUserSlsLogRegionsRequest): DescribeUserSlsLogRegionsResponse {
  var runtime = new $RuntimeOptions{};
  return describeUserSlsLogRegionsWithOptions(request, runtime);
}

model DescribeUserWafLogStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-nwy34****0j'),
  regionId?: string(name='RegionId', description='The region where the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='阿里云资源组ID。', example='rg-acfm***q'),
}

model DescribeUserWafLogStatusResponseBody = {
  logRegionId?: string(name='LogRegionId', description='The ID of the region where WAF logs are stored. Valid values:

*   **cn-hangzhou**: China (Hangzhou).
*   **cn-beijing**: China (Beijing).
*   **cn-hongkong**: China (Hong Kong).
*   **ap-southeast-1**: Singapore.
*   **ap-southeast-3**: Malaysia (Kuala Lumpur).
*   **ap-southeast-5**: Indonesia (Jakarta).
*   **ap-southeast-6**: Philippines (Manila).
*   **ap-southeast-7**: Thailand (Bangkok).
*   **me-east-1**: UAE (Dubai).
*   **eu-central-1**: Germany (Frankfurt).
*   **us-east-1**: US (Virginia).
*   **us-west-1**: US (Silicon Valley).
*   **ap-northeast-1**: Japan (Tokyo).
*   **ap-northeast-2**: South Korea (Seoul).
*   **eu-west-1**: UK (London).
*   **cn-hangzhou-finance**: China East 1 Finance.
*   **cn-shanghai-finance-1**: China East 2 Finance.
*   **cn-shenzhen-finance**: China South 1 Finance.

>  The China East 1 Finance, China East 2 Finance, and China South 1 Finance regions are available only for Alibaba Finance Cloud users. Alibaba Finance Cloud users are also limited to storing logs within these specific regions.', example='cn-hangzhou'),
  logStatus?: string(name='LogStatus', description='The status of WAF logs.

*   **initializing**
*   **initialize_failed**
*   **normal**
*   **releasing**
*   **release_failed**', example='normal'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D****'),
  statusUpdateTime?: long(name='StatusUpdateTime', description='The time when the log status was modified. Unit: milliseconds.', example='1706771796859'),
}

model DescribeUserWafLogStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserWafLogStatusResponseBody(name='body'),
}

/**
 * @summary Queries the status, region ID, and status modification time of Web Application Firewall (WAF) logs.
 *
 * @param request DescribeUserWafLogStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserWafLogStatusResponse
 */
async function describeUserWafLogStatusWithOptions(request: DescribeUserWafLogStatusRequest, runtime: $RuntimeOptions): DescribeUserWafLogStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeUserWafLogStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the status, region ID, and status modification time of Web Application Firewall (WAF) logs.
 *
 * @param request DescribeUserWafLogStatusRequest
 * @return DescribeUserWafLogStatusResponse
 */
async function describeUserWafLogStatus(request: DescribeUserWafLogStatusRequest): DescribeUserWafLogStatusResponse {
  var runtime = new $RuntimeOptions{};
  return describeUserWafLogStatusWithOptions(request, runtime);
}

model DescribeVisitTopIpRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386280'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeVisitTopIpResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='5D2B8DAE-A761-58CB-A68D-74989E4831DA'),
  topIp?: [ 
    {
      area?: string(name='Area', description='The ordinal number of the area to which the IP address belongs.', example='310000'),
      count?: long(name='Count', description='The total number of requests that are sent from the IP address.', example='2622'),
      ip?: string(name='Ip', description='The IP address.', example='1.1.XX.XX'),
      isp?: string(name='Isp', description='The ISP.', example='AAA'),
    }
  ](name='TopIp', description='The array of the top 10 IP addresses from which requests are sent.'),
}

model DescribeVisitTopIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeVisitTopIpResponseBody(name='body'),
}

/**
 * @summary Queries the top 10 IP addresses from which requests are sent.
 *
 * @param request DescribeVisitTopIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeVisitTopIpResponse
 */
async function describeVisitTopIpWithOptions(request: DescribeVisitTopIpRequest, runtime: $RuntimeOptions): DescribeVisitTopIpResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeVisitTopIp',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the top 10 IP addresses from which requests are sent.
 *
 * @param request DescribeVisitTopIpRequest
 * @return DescribeVisitTopIpResponse
 */
async function describeVisitTopIp(request: DescribeVisitTopIpRequest): DescribeVisitTopIpResponse {
  var runtime = new $RuntimeOptions{};
  return describeVisitTopIpWithOptions(request, runtime);
}

model DescribeVisitUasRequest {
  endTimestamp?: string(name='EndTimestamp', description='The end of the time range to query. Unit: seconds. If you do not specify this parameter, the current time is used.', example='1665386280'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object.', example='www.aliyundoc.com'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  startTimestamp?: string(name='StartTimestamp', description='The beginning of the time range to query. Unit: seconds.

This parameter is required.', example='1665331200'),
}

model DescribeVisitUasResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='2847CE98-AFAE-5A64-B80E-60461717F9DE'),
  uas?: [ 
    {
      count?: long(name='Count', description='The number of requests that use the user agent.', example='698455'),
      ua?: string(name='Ua', description='The user agent.', example='chrome'),
    }
  ](name='Uas', description='The array of the top 10 user agents that are used to initiate requests.'),
}

model DescribeVisitUasResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeVisitUasResponseBody(name='body'),
}

/**
 * @summary Queries the top 10 user agents that are used to initiate requests.
 *
 * @param request DescribeVisitUasRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeVisitUasResponse
 */
async function describeVisitUasWithOptions(request: DescribeVisitUasRequest, runtime: $RuntimeOptions): DescribeVisitUasResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.endTimestamp)) {
    query['EndTimestamp'] = request.endTimestamp;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.startTimestamp)) {
    query['StartTimestamp'] = request.startTimestamp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeVisitUas',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the top 10 user agents that are used to initiate requests.
 *
 * @param request DescribeVisitUasRequest
 * @return DescribeVisitUasResponse
 */
async function describeVisitUas(request: DescribeVisitUasRequest): DescribeVisitUasResponse {
  var runtime = new $RuntimeOptions{};
  return describeVisitUasWithOptions(request, runtime);
}

model DescribeWafSourceIpSegmentRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-*****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model DescribeWafSourceIpSegmentResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='9087ADDC-9047-4D02-82A7-33021B58083C'),
  wafSourceIp?: {
    IPv4?: [ string ](name='IPv4', description='An array of back-to-origin IPv4 CIDR blocks.'),
    IPv6?: [ string ](name='IPv6', description='An array of back-to-origin IPv6 CIDR blocks.'),
  }(name='WafSourceIp', description='The back-to-origin CIDR blocks that are used by the protection cluster.'),
}

model DescribeWafSourceIpSegmentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeWafSourceIpSegmentResponseBody(name='body'),
}

/**
 * @summary Queries the back-to-origin CIDR blocks of a Web Application Firewall (WAF) instance.
 *
 * @param request DescribeWafSourceIpSegmentRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeWafSourceIpSegmentResponse
 */
async function describeWafSourceIpSegmentWithOptions(request: DescribeWafSourceIpSegmentRequest, runtime: $RuntimeOptions): DescribeWafSourceIpSegmentResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'DescribeWafSourceIpSegment',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the back-to-origin CIDR blocks of a Web Application Firewall (WAF) instance.
 *
 * @param request DescribeWafSourceIpSegmentRequest
 * @return DescribeWafSourceIpSegmentResponse
 */
async function describeWafSourceIpSegment(request: DescribeWafSourceIpSegmentRequest): DescribeWafSourceIpSegmentResponse {
  var runtime = new $RuntimeOptions{};
  return describeWafSourceIpSegmentWithOptions(request, runtime);
}

model ListTagKeysRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-wwo****iw02'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='caeba0bbb2be03f84eb48b699f0*****'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceType?: string(name='ResourceType', description='The type of the resource. Set the value to ALIYUN::WAF::DEFENSERESOURCE.

This parameter is required.', example='ALIYUN::WAF::DEFENSERESOURCE'),
}

model ListTagKeysResponseBody = {
  keys?: [ 
    {
      category?: string(name='Category', description='The type of the tag. Valid values:

*   custom
*   system', example='custom'),
      key?: string(name='Key', description='The key of the tag.', example='demoTagKey'),
    }
  ](name='Keys', description='The keys and types of the tags.'),
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='caeba0bbb2be03f84eb48b699f0*****'),
  requestId?: string(name='RequestId', description='The request ID.', example='8CB8BB88-24C7-5608-BF5E-4DCA****CF1C'),
}

model ListTagKeysResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagKeysResponseBody(name='body'),
}

/**
 * @summary Queries tag keys.
 *
 * @param request ListTagKeysRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagKeysResponse
 */
async function listTagKeysWithOptions(request: ListTagKeysRequest, runtime: $RuntimeOptions): ListTagKeysResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListTagKeys',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries tag keys.
 *
 * @param request ListTagKeysRequest
 * @return ListTagKeysResponse
 */
async function listTagKeys(request: ListTagKeysRequest): ListTagKeysResponse {
  var runtime = new $RuntimeOptions{};
  return listTagKeysWithOptions(request, runtime);
}

model ListTagResourcesRequest {
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='caeba0bbb2be03f84eb48b699f0*****'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The resource IDs. You can specify up to 50 resource IDs.'),
  resourceType?: string(name='ResourceType', description='The type of the resource. Set the value to ALIYUN::WAF::DEFENSERESOURCE.

This parameter is required.', example='ALIYUN::WAF::DEFENSERESOURCE'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N that is added to the resource. Valid values of N: 1 to 20.', example='Tagkey1'),
      value?: string(name='Value', description='The value of tag N that is added to the resource. Valid values of N: 1 to 20.', example='TagValue1'),
    }
  ](name='Tag', description='The tags that are added to the resource.'),
}

model ListTagResourcesResponseBody = {
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='caeba0bbb2be03f84eb48b699f0*****'),
  requestId?: string(name='RequestId', description='The request ID.', example='716E64DA-044F-51C7-B528-2FBF****AE4F'),
  tagResources?: [ 
    {
      resourceId?: string(name='ResourceId', description='The resource ID.', example='c754d2a4-28f1-46df-b557-9586173a****'),
      resourceType?: string(name='ResourceType', description='The type of the resource. ALIYUN::WAF::DEFENSERESOURCE is returned.', example='ALIYUN::WAF::DEFENSERESOURCE'),
      tagKey?: string(name='TagKey', description='The key of tag N that is added to the resource.', example='TagKey1'),
      tagValue?: string(name='TagValue', description='The value of tag N that is added to the resource.', example='TayValue1'),
    }
  ](name='TagResources', description='The list of resources.'),
}

model ListTagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagResourcesResponseBody(name='body'),
}

/**
 * @summary Queries the tags that are added to a resource.
 *
 * @param request ListTagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagResourcesResponse
 */
async function listTagResourcesWithOptions(request: ListTagResourcesRequest, runtime: $RuntimeOptions): ListTagResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListTagResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the tags that are added to a resource.
 *
 * @param request ListTagResourcesRequest
 * @return ListTagResourcesResponse
 */
async function listTagResources(request: ListTagResourcesRequest): ListTagResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return listTagResourcesWithOptions(request, runtime);
}

model ListTagValuesRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  Obtain the ID of the WAF instance by calling the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation.

This parameter is required.', example='waf_v2_public_cn-lbj****x10g'),
  key?: string(name='Key', description='The tag key.

This parameter is required.', example='demoKey'),
  nextToken?: string(name='NextToken', description='The pagination token that is used in the next request to retrieve a new page of results.', example='caeba0bbb2be03f84eb48b699f0*****'),
  regionId?: string(name='RegionId', description='The region of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-aekzwwk****cv5i'),
  resourceType?: string(name='ResourceType', description='The type of the resource. Set the value to ALIYUN::WAF::DEFENSERESOURCE.

This parameter is required.', example='ALIYUN::WAF::DEFENSERESOURCE'),
}

model ListTagValuesResponseBody = {
  nextToken?: string(name='NextToken', description='A pagination token. It can be used in the next request to retrieve a new page of results. If NextToken is empty, no next page exists.', example='caeba0bbb2be03f84eb48b699f0*****'),
  requestId?: string(name='RequestId', description='The request ID.', example='705114BB-EAEF-5CC4-8837-F1D4****BB5B'),
  values?: [ string ](name='Values', description='The tag values.'),
}

model ListTagValuesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListTagValuesResponseBody(name='body'),
}

/**
 * @summary Queries the tag values of a tag key.
 *
 * @param request ListTagValuesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListTagValuesResponse
 */
async function listTagValuesWithOptions(request: ListTagValuesRequest, runtime: $RuntimeOptions): ListTagValuesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.key)) {
    query['Key'] = request.key;
  }
  if (!$isNull(request.nextToken)) {
    query['NextToken'] = request.nextToken;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ListTagValues',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the tag values of a tag key.
 *
 * @param request ListTagValuesRequest
 * @return ListTagValuesResponse
 */
async function listTagValues(request: ListTagValuesRequest): ListTagValuesResponse {
  var runtime = new $RuntimeOptions{};
  return listTagValuesWithOptions(request, runtime);
}

model ModifyApisecAbnormalsRequest {
  abnormalIds?: [ string ](name='AbnormalIds', description='The risk IDs.

This parameter is required.'),
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.

>  This parameter is available only in hybrid cloud scenarios. You can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query hybrid cloud clusters.', example='428'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-****'),
  note?: string(name='Note', description='The description.', example='already fixed.'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  userStatus?: string(name='UserStatus', description='The risk status. Valid values:

*   **toBeConfirmed**
*   **confirmed**
*   **toBeFixed**
*   **fixed**
*   **ignored**

This parameter is required.', example='fixed'),
}

model ModifyApisecAbnormalsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='C1823E96-EF4B-5BD2-9E02-1D18****3ED8'),
}

model ModifyApisecAbnormalsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyApisecAbnormalsResponseBody(name='body'),
}

/**
 * @summary Modifies the status of multiple risks detected by the API security module at a time.
 *
 * @param request ModifyApisecAbnormalsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyApisecAbnormalsResponse
 */
async function modifyApisecAbnormalsWithOptions(request: ModifyApisecAbnormalsRequest, runtime: $RuntimeOptions): ModifyApisecAbnormalsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.abnormalIds)) {
    query['AbnormalIds'] = request.abnormalIds;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.note)) {
    query['Note'] = request.note;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.userStatus)) {
    query['UserStatus'] = request.userStatus;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyApisecAbnormals',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the status of multiple risks detected by the API security module at a time.
 *
 * @param request ModifyApisecAbnormalsRequest
 * @return ModifyApisecAbnormalsResponse
 */
async function modifyApisecAbnormals(request: ModifyApisecAbnormalsRequest): ModifyApisecAbnormalsResponse {
  var runtime = new $RuntimeOptions{};
  return modifyApisecAbnormalsWithOptions(request, runtime);
}

model ModifyApisecApiResourceRequest {
  apiId?: string(name='ApiId', description='The ID of the API.

This parameter is required.', example='c68995b89069595c5c0399676f3ca64f'),
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  follow?: long(name='Follow', description='Specifies whether to follow the API. Valid values:

*   **1**: yes
*   **0** (default): no', example='0'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  note?: string(name='Note', description='The remarks.', example='know'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ModifyApisecApiResourceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model ModifyApisecApiResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyApisecApiResourceResponseBody(name='body'),
}

/**
 * @summary Modifies the annotations of APIs in the API security module.
 *
 * @param request ModifyApisecApiResourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyApisecApiResourceResponse
 */
async function modifyApisecApiResourceWithOptions(request: ModifyApisecApiResourceRequest, runtime: $RuntimeOptions): ModifyApisecApiResourceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.apiId)) {
    query['ApiId'] = request.apiId;
  }
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.follow)) {
    query['Follow'] = request.follow;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.note)) {
    query['Note'] = request.note;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyApisecApiResource',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the annotations of APIs in the API security module.
 *
 * @param request ModifyApisecApiResourceRequest
 * @return ModifyApisecApiResourceResponse
 */
async function modifyApisecApiResource(request: ModifyApisecApiResourceRequest): ModifyApisecApiResourceResponse {
  var runtime = new $RuntimeOptions{};
  return modifyApisecApiResourceWithOptions(request, runtime);
}

model ModifyApisecEventsRequest {
  clusterId?: string(name='ClusterId', description='The ID of the hybrid cloud cluster.
>For hybrid cloud scenarios only, you can call the [DescribeHybridCloudClusters](https://help.aliyun.com/document_detail/2849376.html) operation to query the hybrid cloud clusters.', example='428'),
  eventIds?: [ string ](name='EventIds', description='The IDs of the security events.

This parameter is required.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_***'),
  note?: string(name='Note', description='The description.', example='already confirmed.'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='阿里云资源组ID。', example='rg-acfm***q'),
  userStatus?: string(name='UserStatus', description='The status of the event. Valid values:

*   **toBeConfirmed**
*   **confirmed**
*   **ignored**

This parameter is required.', example='confirmed'),
}

model ModifyApisecEventsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-****-6B19160D5EB0'),
}

model ModifyApisecEventsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyApisecEventsResponseBody(name='body'),
}

/**
 * @summary Modifies the status of multiple security events detected by the API security module at a time.
 *
 * @param request ModifyApisecEventsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyApisecEventsResponse
 */
async function modifyApisecEventsWithOptions(request: ModifyApisecEventsRequest, runtime: $RuntimeOptions): ModifyApisecEventsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.eventIds)) {
    query['EventIds'] = request.eventIds;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.note)) {
    query['Note'] = request.note;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.userStatus)) {
    query['UserStatus'] = request.userStatus;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyApisecEvents',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the status of multiple security events detected by the API security module at a time.
 *
 * @param request ModifyApisecEventsRequest
 * @return ModifyApisecEventsResponse
 */
async function modifyApisecEvents(request: ModifyApisecEventsRequest): ModifyApisecEventsResponse {
  var runtime = new $RuntimeOptions{};
  return modifyApisecEventsWithOptions(request, runtime);
}

model ModifyApisecLogDeliveryRequest {
  assertKey?: string(name='AssertKey', description='The type of the log subscription. Valid values:

*   **risk**: risk information.
*   **event**: attack event information.
*   **asset**: asset information.

This parameter is required.', example='risk'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3_public_cn-uqm2z****0a'),
  logRegionId?: string(name='LogRegionId', description='The ID of the region where logs are stored.

>  You can call the [DescribeUserSlsLogRegions](https://help.aliyun.com/document_detail/2712598.html) operation to query available log storage regions.

This parameter is required.', example='cn-hangzhou'),
  logStoreName?: string(name='LogStoreName', description='The name of the Logstore in Simple Log Service.

>  API security logs can be delivered only to Logstores whose names start with apisec-.

This parameter is required.', example='apisec-logstore***'),
  projectName?: string(name='ProjectName', description='The name of the project in Simple Log Service.

>  API security logs can be delivered only to projects whose names start with apisec-.

This parameter is required.', example='apisec-project-14316572********'),
  regionId?: string(name='RegionId', description='The region where the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ModifyApisecLogDeliveryResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='F35F45B0-5D6B-4238-BE02-A62D****E840'),
}

model ModifyApisecLogDeliveryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyApisecLogDeliveryResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of API security log subscription.
 *
 * @param request ModifyApisecLogDeliveryRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyApisecLogDeliveryResponse
 */
async function modifyApisecLogDeliveryWithOptions(request: ModifyApisecLogDeliveryRequest, runtime: $RuntimeOptions): ModifyApisecLogDeliveryResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.assertKey)) {
    query['AssertKey'] = request.assertKey;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.logRegionId)) {
    query['LogRegionId'] = request.logRegionId;
  }
  if (!$isNull(request.logStoreName)) {
    query['LogStoreName'] = request.logStoreName;
  }
  if (!$isNull(request.projectName)) {
    query['ProjectName'] = request.projectName;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyApisecLogDelivery',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of API security log subscription.
 *
 * @param request ModifyApisecLogDeliveryRequest
 * @return ModifyApisecLogDeliveryResponse
 */
async function modifyApisecLogDelivery(request: ModifyApisecLogDeliveryRequest): ModifyApisecLogDeliveryResponse {
  var runtime = new $RuntimeOptions{};
  return modifyApisecLogDeliveryWithOptions(request, runtime);
}

model ModifyApisecLogDeliveryStatusRequest {
  assertKey?: string(name='AssertKey', description='The type of the log subscription. Valid values:

*   **risk**: risk information.
*   **event**: attack event information.
*   **asset**: asset information.

This parameter is required.', example='risk'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3_public_cn-uqm2z****0a'),
  regionId?: string(name='RegionId', description='The region where the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  status?: boolean(name='Status', description='The status of API security log subscription. Valid values:

*   **true**: enabled.
*   **false**: disabled.

This parameter is required.', example='true'),
}

model ModifyApisecLogDeliveryStatusResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='F35F45B0-5D6B-4238-BE02-A62D****E840'),
}

model ModifyApisecLogDeliveryStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyApisecLogDeliveryStatusResponseBody(name='body'),
}

/**
 * @summary Modifies the status of API security log subscription.
 *
 * @param request ModifyApisecLogDeliveryStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyApisecLogDeliveryStatusResponse
 */
async function modifyApisecLogDeliveryStatusWithOptions(request: ModifyApisecLogDeliveryStatusRequest, runtime: $RuntimeOptions): ModifyApisecLogDeliveryStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.assertKey)) {
    query['AssertKey'] = request.assertKey;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyApisecLogDeliveryStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the status of API security log subscription.
 *
 * @param request ModifyApisecLogDeliveryStatusRequest
 * @return ModifyApisecLogDeliveryStatusResponse
 */
async function modifyApisecLogDeliveryStatus(request: ModifyApisecLogDeliveryStatusRequest): ModifyApisecLogDeliveryStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyApisecLogDeliveryStatusWithOptions(request, runtime);
}

model ModifyApisecModuleStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_elasticity-cn-0xldbqtm**'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  reportStatus?: long(name='ReportStatus', description='The status of the compliance check feature. Valid values:

*   **1**: enabled
*   **0**: disabled', example='1'),
  resourceGroups?: string(name='ResourceGroups', description='The name of the protected object group to which the protected object belongs.', example='group1'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  resources?: string(name='Resources', description='The name of the protected object.', example='cwaf-***-waf'),
  traceStatus?: int32(name='TraceStatus', description='The status of the tracing and auditing feature. Valid values:

*   **1**: enabled
*   **0**: disabled', example='1'),
}

model ModifyApisecModuleStatusResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model ModifyApisecModuleStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyApisecModuleStatusResponseBody(name='body'),
}

/**
 * @summary Changes the status of features in the API security module for protected objects or protected object groups.
 *
 * @param request ModifyApisecModuleStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyApisecModuleStatusResponse
 */
async function modifyApisecModuleStatusWithOptions(request: ModifyApisecModuleStatusRequest, runtime: $RuntimeOptions): ModifyApisecModuleStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.reportStatus)) {
    query['ReportStatus'] = request.reportStatus;
  }
  if (!$isNull(request.resourceGroups)) {
    query['ResourceGroups'] = request.resourceGroups;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resources)) {
    query['Resources'] = request.resources;
  }
  if (!$isNull(request.traceStatus)) {
    query['TraceStatus'] = request.traceStatus;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyApisecModuleStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the status of features in the API security module for protected objects or protected object groups.
 *
 * @param request ModifyApisecModuleStatusRequest
 * @return ModifyApisecModuleStatusResponse
 */
async function modifyApisecModuleStatus(request: ModifyApisecModuleStatusRequest): ModifyApisecModuleStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyApisecModuleStatusWithOptions(request, runtime);
}

model ModifyApisecStatusRequest {
  apisecStatus?: int32(name='ApisecStatus', description='The status of the API security module. Valid values:

*   **1**: enabled
*   **0**: disabled

This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland', example='cn-hangzhou'),
  resourceGroups?: string(name='ResourceGroups', description='The name of the protected object group to which the protected object belongs.', example='group'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  resources?: string(name='Resources', description='The name of the protected object.', example='alb-wewbb23dfset***'),
}

model ModifyApisecStatusResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyApisecStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyApisecStatusResponseBody(name='body'),
}

/**
 * @summary Changes the status of the API security module for protected objects or protected object groups.
 *
 * @param request ModifyApisecStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyApisecStatusResponse
 */
async function modifyApisecStatusWithOptions(request: ModifyApisecStatusRequest, runtime: $RuntimeOptions): ModifyApisecStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.apisecStatus)) {
    query['ApisecStatus'] = request.apisecStatus;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceGroups)) {
    query['ResourceGroups'] = request.resourceGroups;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.resources)) {
    query['Resources'] = request.resources;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyApisecStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the status of the API security module for protected objects or protected object groups.
 *
 * @param request ModifyApisecStatusRequest
 * @return ModifyApisecStatusResponse
 */
async function modifyApisecStatus(request: ModifyApisecStatusRequest): ModifyApisecStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyApisecStatusWithOptions(request, runtime);
}

model ModifyCloudResourceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-***'),
  listen?: {
    certificates?: [ 
      {
        appliedType?: string(name='AppliedType', description='The type of the certificate. Valid values:

*   **default**: default certificate.
*   **extension**: additional certificate.', example='default'),
        certificateId?: string(name='CertificateId', description='The ID of the certificate.', example='123-cn-hangzhou'),
      }
    ](name='Certificates', description='The certificates.'),
    cipherSuite?: int32(name='CipherSuite', description='The type of the cipher suites that you want to add. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **1**: all cipher suites.
*   **2**: strong cipher suites. This value is available only if you set **TLSVersion** to **tlsv1.2**.
*   **99**: custom cipher suites.', example='1'),
    customCiphers?: [ string ](name='CustomCiphers', description='The custom cipher suites that you want to add.'),
    enableTLSv3?: boolean(name='EnableTLSv3', description='Specifies whether to support TLS 1.3. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false**', example='true', nullable=true),
    http2Enabled?: boolean(name='Http2Enabled', description='Specifies whether to enable HTTP/2. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false** (default)', example='true'),
    port?: int32(name='Port', description='The port of the cloud service instance that is added to WAF.

This parameter is required.', example='80'),
    protocol?: string(name='Protocol', description='The protocol type. Valid values:

*   **http**
*   **https**

This parameter is required.', example='http'),
    resourceInstanceId?: string(name='ResourceInstanceId', description='The ID of the cloud service instance that is added to WAF.

This parameter is required.', example='lb-***'),
    resourceProduct?: string(name='ResourceProduct', description='The type of the cloud service. Valid values:

*   **clb4**: Layer 4 Classic Load Balancer (CLB).
*   **clb7**: Layer 7 CLB.
*   **ecs**: Elastic Compute Service (ECS).
*   **nlb**: Network Load Balancer (NLB).

This parameter is required.', example='clb7'),
    TLSVersion?: string(name='TLSVersion', description='The Transport Layer Security (TLS) version that you want to add. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **tlsv1**
*   **tlsv1.1**
*   **tlsv1.2**', example='tlsv1.2'),
  }(name='Listen', description='The listener configurations.

This parameter is required.'),
  redirect?: {
    keepalive?: boolean(name='Keepalive', description='Specifies whether to enable the persistent connection feature. Valid values:

*   **true** (default)
*   **false**', example='true'),
    keepaliveRequests?: int32(name='KeepaliveRequests', description='The number of reused persistent connections. Valid values: 60 to 1000.

>  This parameter specifies the number of persistent connections that can be reused after you enable the persistent connection feature.', example='1000'),
    keepaliveTimeout?: int32(name='KeepaliveTimeout', description='The timeout period of idle persistent connections. Valid values: 10 to 3600. Default value: 3600. Unit: seconds.

>  This parameter specifies the period of time after which an idle persistent connection is closed.', example='15'),
    readTimeout?: int32(name='ReadTimeout', description='The timeout period of read connections. Unit: seconds. Valid values: 1 to 3600.', example='1'),
    requestHeaders?: [ 
      {
        key?: string(name='Key', description='The key of the custom header field.', example='key1'),
        value?: string(name='Value', description='The value of the custom header field.', example='value1'),
      }
    ](name='RequestHeaders', description='The custom header fields, which are key-value pairs. The fields are used to mark requests that pass through WAF.'),
    writeTimeout?: int32(name='WriteTimeout', description='The timeout period of write connections. Unit: seconds. Valid values: 1 to 3600.', example='1'),
    xffHeaderMode?: int32(name='XffHeaderMode', description='The method that is used to obtain the originating IP address of a client. Valid values:

*   **0**: No Layer 7 proxies are deployed in front of WAF.
*   **1**: WAF reads the first value of the X-Forwarded-For (XFF) header field as the originating IP address of the client.
*   **2**: WAF reads the value of a custom header field as the originating IP address of the client.', example='0'),
    xffHeaders?: [ string ](name='XffHeaders', description='The custom header fields that are used to obtain the originating IP address of a client. Specify the value in the ["header1","header2",...] format.

>  This parameter is required only if you set **XffHeaderMode** to 2.'),
    xffProto?: boolean(name='XffProto', description='Specifies whether to use the X-Forward-For-Proto header field to pass the protocol used by WAF to forward requests to the origin server. Valid values:

*   **true** (default)
*   **false**', example='true'),
  }(name='Redirect', description='The forwarding configurations.'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ModifyCloudResourceShrinkRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-***'),
  listenShrink?: string(name='Listen', description='The listener configurations.

This parameter is required.'),
  redirectShrink?: string(name='Redirect', description='The forwarding configurations.'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ModifyCloudResourceResponseBody = {
  cloudResource?: string(name='CloudResource', description='The ID of the resource that is added to WAF.', example='lb-xxx-80-clb7'),
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-***'),
}

model ModifyCloudResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyCloudResourceResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a service that is added to Web Application Firewall (WAF).
 *
 * @param tmpReq ModifyCloudResourceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyCloudResourceResponse
 */
async function modifyCloudResourceWithOptions(tmpReq: ModifyCloudResourceRequest, runtime: $RuntimeOptions): ModifyCloudResourceResponse {
  tmpReq.validate();
  var request = new ModifyCloudResourceShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.listen)) {
    request.listenShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.listen, 'Listen', 'json');
  }
  if (!$isNull(tmpReq.redirect)) {
    request.redirectShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.redirect, 'Redirect', 'json');
  }
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.listenShrink)) {
    query['Listen'] = request.listenShrink;
  }
  if (!$isNull(request.redirectShrink)) {
    query['Redirect'] = request.redirectShrink;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyCloudResource',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a service that is added to Web Application Firewall (WAF).
 *
 * @param request ModifyCloudResourceRequest
 * @return ModifyCloudResourceResponse
 */
async function modifyCloudResource(request: ModifyCloudResourceRequest): ModifyCloudResourceResponse {
  var runtime = new $RuntimeOptions{};
  return modifyCloudResourceWithOptions(request, runtime);
}

model ModifyDefaultHttpsRequest {
  certId?: string(name='CertId', description='The ID of the certificate.

This parameter is required.', example='123-cn-hangzhou'),
  cipherSuite?: int32(name='CipherSuite', description='The type of the cipher suites. Valid values:

*   **1**: all cipher suites.
*   **2**: strong cipher suites.
*   **99**: custom cipher suites.', example='0'),
  customCiphers?: [ string ](name='CustomCiphers', description='The custom cipher suites that you want to add. This parameter is available only if you set **CipherSuite** to **99**.'),
  enableTLSv3?: boolean(name='EnableTLSv3', description='Specifies whether to support TLS 1.3. Valid values:

*   **true**
*   **false**', example='true'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='阿里云资源组ID。', example='rg-acfm***q'),
  TLSVersion?: string(name='TLSVersion', description='The version of the TLS protocol. Valid values:

*   **tlsv1**
*   **tlsv1.1**
*   **tlsv1.2**

This parameter is required.', example='tlsv1'),
}

model ModifyDefaultHttpsResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='276D7566-31C9-4192-9DD1-***'),
}

model ModifyDefaultHttpsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDefaultHttpsResponseBody(name='body'),
}

/**
 * @summary Modifies the default Secure Sockets Layer (SSL) and Transport Layer Security (TLS) settings.
 *
 * @param request ModifyDefaultHttpsRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDefaultHttpsResponse
 */
async function modifyDefaultHttpsWithOptions(request: ModifyDefaultHttpsRequest, runtime: $RuntimeOptions): ModifyDefaultHttpsResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.certId)) {
    query['CertId'] = request.certId;
  }
  if (!$isNull(request.cipherSuite)) {
    query['CipherSuite'] = request.cipherSuite;
  }
  if (!$isNull(request.customCiphers)) {
    query['CustomCiphers'] = request.customCiphers;
  }
  if (!$isNull(request.enableTLSv3)) {
    query['EnableTLSv3'] = request.enableTLSv3;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.TLSVersion)) {
    query['TLSVersion'] = request.TLSVersion;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDefaultHttps',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the default Secure Sockets Layer (SSL) and Transport Layer Security (TLS) settings.
 *
 * @param request ModifyDefaultHttpsRequest
 * @return ModifyDefaultHttpsResponse
 */
async function modifyDefaultHttps(request: ModifyDefaultHttpsRequest): ModifyDefaultHttpsResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDefaultHttpsWithOptions(request, runtime);
}

model ModifyDefenseResourceGroupRequest {
  addList?: string(name='AddList', description='The protected objects that you want to add to the protected object group. Separate the protected objects with commas (,). If you leave this parameter empty, no protected objects are added to the protected object group.', example='test1.aliyundoc.com,test2.aliyundoc.com'),
  deleteList?: string(name='DeleteList', description='The protected objects that you want to remove from the protected object group. Separate the protected objects with commas (,). If you leave this parameter empty, no protected objects are removed from the protected object group.', example='test14.waf.com,test24.waf.com'),
  description?: string(name='Description', description='The description of the protected object group.', example='test'),
  groupName?: string(name='GroupName', description='The name of the protected object group whose configurations you want to modify.

This parameter is required.', example='test01'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
}

model ModifyDefenseResourceGroupResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='2CC1AFDE-BB31-5A2F-906E-92FCBDDE6B75'),
}

model ModifyDefenseResourceGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDefenseResourceGroupResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a protected object group.
 *
 * @param request ModifyDefenseResourceGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDefenseResourceGroupResponse
 */
async function modifyDefenseResourceGroupWithOptions(request: ModifyDefenseResourceGroupRequest, runtime: $RuntimeOptions): ModifyDefenseResourceGroupResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.addList)) {
    query['AddList'] = request.addList;
  }
  if (!$isNull(request.deleteList)) {
    query['DeleteList'] = request.deleteList;
  }
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDefenseResourceGroup',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a protected object group.
 *
 * @param request ModifyDefenseResourceGroupRequest
 * @return ModifyDefenseResourceGroupResponse
 */
async function modifyDefenseResourceGroup(request: ModifyDefenseResourceGroupRequest): ModifyDefenseResourceGroupResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDefenseResourceGroupWithOptions(request, runtime);
}

model ModifyDefenseResourceXffRequest {
  acwCookieStatus?: int32(name='AcwCookieStatus', description='The status of the tracking cookie.

*   **0**: disabled
*   **1**: enabled. This is the default value.', example='0'),
  acwSecureStatus?: int32(name='AcwSecureStatus', description='The status of the secure attribute of the tracking cookie.

*   **0**: disabled. This is the default value.
*   **1**: enabled.', example='0'),
  acwV3SecureStatus?: int32(name='AcwV3SecureStatus', description='The status of the secure attribute of the slider CAPTCHA cookie.

*   **0**: disabled. This is the default value.
*   **1**: enabled.', example='0'),
  customHeaders?: [ string ](name='CustomHeaders', description='The custom header fields.

>  The first IP address in the specified custom header field is used as the originating IP address of the client to prevent X-Forwarded-For forgery. If you specify multiple header fields, WAF reads the values of the header fields in sequence until the originating IP address is obtained. If the originating IP address cannot be obtained, the first IP address in the X-Forwarded-For header is used as the originating IP address of the client.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-wwo3c****07'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The name of the protected object.

This parameter is required.', example='alb-4pxu81fgagx3****mz-alb'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm2kie2****wq'),
  responseHeaders?: [ 
    {
      key?: string(name='Key', description='Specifies the key for a custom response header.', example='Header-Key'),
      value?: string(name='Value', description='Specifies the value for a custom response header.', example='Header-Value'),
    }
  ](name='ResponseHeaders', description='The response header.'),
  xffStatus?: int32(name='XffStatus', description='Specifies whether a Layer 7 proxy is deployed in front of WAF. Layer 7 proxies include Anti-DDoS Proxy and Alibaba Cloud CDN. Valid values:

*   **0**: No Layer 7 proxies are deployed. This is the default value.
*   **1**: A Layer 7 proxy is deployed.

This parameter is required.', example='0'),
}

model ModifyDefenseResourceXffResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='6C094583-9B3F-5BD8-8748-DC638E****BF'),
}

model ModifyDefenseResourceXffResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDefenseResourceXffResponseBody(name='body'),
}

/**
 * @summary Modifies the cookie settings of a protected object and the method to identify the originating IP addresses of clients.
 *
 * @param request ModifyDefenseResourceXffRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDefenseResourceXffResponse
 */
async function modifyDefenseResourceXffWithOptions(request: ModifyDefenseResourceXffRequest, runtime: $RuntimeOptions): ModifyDefenseResourceXffResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.acwCookieStatus)) {
    query['AcwCookieStatus'] = request.acwCookieStatus;
  }
  if (!$isNull(request.acwSecureStatus)) {
    query['AcwSecureStatus'] = request.acwSecureStatus;
  }
  if (!$isNull(request.acwV3SecureStatus)) {
    query['AcwV3SecureStatus'] = request.acwV3SecureStatus;
  }
  if (!$isNull(request.customHeaders)) {
    query['CustomHeaders'] = request.customHeaders;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.responseHeaders)) {
    query['ResponseHeaders'] = request.responseHeaders;
  }
  if (!$isNull(request.xffStatus)) {
    query['XffStatus'] = request.xffStatus;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDefenseResourceXff',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the cookie settings of a protected object and the method to identify the originating IP addresses of clients.
 *
 * @param request ModifyDefenseResourceXffRequest
 * @return ModifyDefenseResourceXffResponse
 */
async function modifyDefenseResourceXff(request: ModifyDefenseResourceXffRequest): ModifyDefenseResourceXffResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDefenseResourceXffWithOptions(request, runtime);
}

model ModifyDefenseRuleRequest {
  defenseScene?: string(name='DefenseScene', description='The scenario in which you want to use the protection rule. For more information, see the description of the **DefenseScene** parameter in the [CreateDefenseRule](~~CreateDefenseRule~~) topic.

This parameter is required.', example='waf_group'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  rules?: string(name='Rules', description='This parameter is required.'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template to which the protection rule whose configurations you want to modify belongs.', example='5325'),
}

model ModifyDefenseRuleResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='1EEA9C98-F166-54FE-ADE3-08D8****BDFA'),
}

model ModifyDefenseRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDefenseRuleResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a protection rule.
 *
 * @param request ModifyDefenseRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDefenseRuleResponse
 */
async function modifyDefenseRuleWithOptions(request: ModifyDefenseRuleRequest, runtime: $RuntimeOptions): ModifyDefenseRuleResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.defenseScene)) {
    query['DefenseScene'] = request.defenseScene;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var body : map[string]any = {};
  if (!$isNull(request.rules)) {
    body['Rules'] = request.rules;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDefenseRule',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a protection rule.
 *
 * @param request ModifyDefenseRuleRequest
 * @return ModifyDefenseRuleResponse
 */
async function modifyDefenseRule(request: ModifyDefenseRuleRequest): ModifyDefenseRuleResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDefenseRuleWithOptions(request, runtime);
}

model ModifyDefenseRuleCacheRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-zvp****xm2r'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  ruleId?: long(name='RuleId', description='The ID of the protection rule.

This parameter is required.', example='12345678'),
  templateId?: long(name='TemplateId', description='The ID of the protection template.

This parameter is required.', example='12345'),
}

model ModifyDefenseRuleCacheResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='A0F2B994-8645-5270-A05D-9DAD8C****B6'),
}

model ModifyDefenseRuleCacheResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDefenseRuleCacheResponseBody(name='body'),
}

/**
 * @summary Updates the cached page of a website that is protected based on a website tamper-proofing rule.
 *
 * @param request ModifyDefenseRuleCacheRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDefenseRuleCacheResponse
 */
async function modifyDefenseRuleCacheWithOptions(request: ModifyDefenseRuleCacheRequest, runtime: $RuntimeOptions): ModifyDefenseRuleCacheResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDefenseRuleCache',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Updates the cached page of a website that is protected based on a website tamper-proofing rule.
 *
 * @param request ModifyDefenseRuleCacheRequest
 * @return ModifyDefenseRuleCacheResponse
 */
async function modifyDefenseRuleCache(request: ModifyDefenseRuleCacheRequest): ModifyDefenseRuleCacheResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDefenseRuleCacheWithOptions(request, runtime);
}

model ModifyDefenseRuleStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleId?: long(name='RuleId', description='The ID of the protection rule whose status you want to change.

This parameter is required.', example='20002615'),
  ruleStatus?: int32(name='RuleStatus', description='The new status of the protection rule. Valid values:

*   **0:** disabled.
*   **1:** enabled.

This parameter is required.', example='1'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template to which the protection rule whose status you want to change belongs.

This parameter is required.', example='7239'),
}

model ModifyDefenseRuleStatusResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='BB305BF3-3C71-57A9-9704-E22F567689B0'),
}

model ModifyDefenseRuleStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDefenseRuleStatusResponseBody(name='body'),
}

/**
 * @summary Changes the status of a protection rule.
 *
 * @param request ModifyDefenseRuleStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDefenseRuleStatusResponse
 */
async function modifyDefenseRuleStatusWithOptions(request: ModifyDefenseRuleStatusRequest, runtime: $RuntimeOptions): ModifyDefenseRuleStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!$isNull(request.ruleStatus)) {
    query['RuleStatus'] = request.ruleStatus;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDefenseRuleStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the status of a protection rule.
 *
 * @param request ModifyDefenseRuleStatusRequest
 * @return ModifyDefenseRuleStatusResponse
 */
async function modifyDefenseRuleStatus(request: ModifyDefenseRuleStatusRequest): ModifyDefenseRuleStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDefenseRuleStatusWithOptions(request, runtime);
}

model ModifyDefenseTemplateRequest {
  description?: string(name='Description', description='The description of the protection rule template whose configurations you want to modify.', example='test'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template whose configurations you want to modify.

This parameter is required.', example='7392'),
  templateName?: string(name='TemplateName', description='The name of the protection rule template whose configurations you want to modify.

This parameter is required.', example='test'),
}

model ModifyDefenseTemplateResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='1A68C85D-7467-5BB1-9A7E-2E8A5D96D88A'),
}

model ModifyDefenseTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDefenseTemplateResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a protection rule template.
 *
 * @param request ModifyDefenseTemplateRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDefenseTemplateResponse
 */
async function modifyDefenseTemplateWithOptions(request: ModifyDefenseTemplateRequest, runtime: $RuntimeOptions): ModifyDefenseTemplateResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  if (!$isNull(request.templateName)) {
    query['TemplateName'] = request.templateName;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDefenseTemplate',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a protection rule template.
 *
 * @param request ModifyDefenseTemplateRequest
 * @return ModifyDefenseTemplateResponse
 */
async function modifyDefenseTemplate(request: ModifyDefenseTemplateRequest): ModifyDefenseTemplateResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDefenseTemplateWithOptions(request, runtime);
}

model ModifyDefenseTemplateStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template whose status you want to change.

This parameter is required.', example='2249'),
  templateStatus?: int32(name='TemplateStatus', description='The new status of the protection rule template. Valid values:

*   **0:** disabled.
*   **1:** enabled.

This parameter is required.', example='1'),
}

model ModifyDefenseTemplateStatusResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='58007AE3-65D9-57BA-ABB4-1A544015FB50'),
}

model ModifyDefenseTemplateStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDefenseTemplateStatusResponseBody(name='body'),
}

/**
 * @summary Changes the status of a protection rule template.
 *
 * @param request ModifyDefenseTemplateStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDefenseTemplateStatusResponse
 */
async function modifyDefenseTemplateStatusWithOptions(request: ModifyDefenseTemplateStatusRequest, runtime: $RuntimeOptions): ModifyDefenseTemplateStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  if (!$isNull(request.templateStatus)) {
    query['TemplateStatus'] = request.templateStatus;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDefenseTemplateStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Changes the status of a protection rule template.
 *
 * @param request ModifyDefenseTemplateStatusRequest
 * @return ModifyDefenseTemplateStatusResponse
 */
async function modifyDefenseTemplateStatus(request: ModifyDefenseTemplateStatusRequest): ModifyDefenseTemplateStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDefenseTemplateStatusWithOptions(request, runtime);
}

model ModifyDomainRequest {
  accessType?: string(name='AccessType', description='The mode in which you want to add the domain name to WAF. Set the value to share.

*   **share:** adds the domain name to WAF in CNAME record mode. This is the default value.', example='share'),
  domain?: string(name='Domain', description='The domain name whose access configurations you want to modify.

This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  listen?: {
    certId?: string(name='CertId', description='The ID of the certificate that you want to add.', example='123'),
    cipherSuite?: int32(name='CipherSuite', description='The type of the cipher suites that you want to add. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **1**: all cipher suites.
*   **2**: strong cipher suites. This value is available only if you set **TLSVersion** to **tlsv1.2**.
*   **99**: custom cipher suites.', example='2'),
    customCiphers?: [ string ](name='CustomCiphers', description='The custom cipher suites that you want to add. This parameter is available only if you set **CipherSuite** to **99**.'),
    enableTLSv3?: boolean(name='EnableTLSv3', description='Specifies whether to support TLS 1.3. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false**', example='true'),
    exclusiveIp?: boolean(name='ExclusiveIp', description='Specifies whether to enable the exclusive IP address feature. This parameter is available only if you set **IPv6Enabled** to false and **ProtectionResource** to **share**. Valid values:

*   **true**
*   **false** (default)', example='true'),
    focusHttps?: boolean(name='FocusHttps', description='Specifies whether to enable force redirect from HTTP to HTTPS for received requests. This parameter is available only if you specify **HttpsPorts** and leave **HttpPorts** empty. Valid values:

*   **true**
*   **false**', example='true'),
    http2Enabled?: boolean(name='Http2Enabled', description='Specifies whether to enable HTTP/2. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false** (default)', example='true'),
    httpPorts?: [ int32 ](name='HttpPorts', description='The HTTP listener ports. Specify the value in the [**port1,port2,...**] format.'),
    httpsPorts?: [ int32 ](name='HttpsPorts', description='The HTTPS listener ports. Specify the value in the [**port1,port2,...**] format.'),
    IPv6Enabled?: boolean(name='IPv6Enabled', description='Specifies whether to enable IPv6 protection. Valid values:

*   **true**
*   **false** (default)', example='true'),
    protectionResource?: string(name='ProtectionResource', description='The type of the protection resource. Valid values:

*   **share** (default): a shared cluster.
*   **gslb**: shared cluster-based intelligent load balancing.', example='share'),
    SM2AccessOnly?: boolean(name='SM2AccessOnly', description='Specifies whether to allow access only from SM certificate-based clients. This parameter is available only if you set SM2Enabled to true.

*   true
*   false', example='true'),
    SM2CertId?: string(name='SM2CertId', description='The ID of the SM certificate that you want to add. This parameter is available only if you set SM2Enabled to true.', example='123-cn-hangzhou'),
    SM2Enabled?: boolean(name='SM2Enabled', description='Specifies whether to add an SM certificate.', example='true'),
    TLSVersion?: string(name='TLSVersion', description='The Transport Layer Security (TLS) version that you want to add. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **tlsv1**
*   **tlsv1.1**
*   **tlsv1.2**', example='tlsv1'),
    xffHeaderMode?: int32(name='XffHeaderMode', description='The method that is used to obtain the originating IP address of a client. Valid values:

*   **0** (default): Client traffic is not filtered by a Layer 7 proxy before the traffic reaches WAF.
*   **1**: WAF reads the first value of the X-Forwarded-For (XFF) header field as the originating IP address of the client.
*   **2**: WAF reads the value of a custom header field as the originating IP address of the client.', example='2'),
    xffHeaders?: [ string ](name='XffHeaders', description='The custom header fields that are used to obtain the originating IP address of a client. Specify the value in the **["header1","header2",...]** format.

>  This parameter is required only if you set **XffHeaderMode** to 2.'),
  }(name='Listen', description='The listener configurations.

This parameter is required.'),
  redirect?: {
    backends?: [ string ](name='Backends', description='The IP addresses or domain names of the origin server. You cannot specify both IP addresses and domain names. If you specify domain names, the domain names can be resolved only to IPv4 addresses.

*   If you specify IP addresses, specify the value in the **["ip1","ip2",...]** format. You can enter up to 20 IP addresses.
*   If you specify domain names, specify the value in the **["domain"]** format. You can enter up to 20 domain names.'),
    backupBackends?: [ string ](name='BackupBackends', description='The secondary IP addresses or domain names of the origin server.'),
    cnameEnabled?: boolean(name='CnameEnabled', description='Specifies whether to enable the public cloud disaster recovery feature. Valid values:

*   **true**
*   **false** (default)', example='true'),
    connectTimeout?: int32(name='ConnectTimeout', description='The timeout period of connections. Unit: seconds. Valid values: 1 to 3600.', example='120'),
    focusHttpBackend?: boolean(name='FocusHttpBackend', description='Specifies whether to enable force redirect from HTTPS to HTTP for back-to-origin requests. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false**', example='true'),
    keepalive?: boolean(name='Keepalive', description='Specifies whether to enable the persistent connection feature. Valid values:

*   **true** (default)
*   **false**', example='true'),
    keepaliveRequests?: int32(name='KeepaliveRequests', description='The number of reused persistent connections. Valid values: 60 to 1000.

>  This parameter specifies the number of persistent connections that can be reused after you enable the persistent connection feature.', example='1000'),
    keepaliveTimeout?: int32(name='KeepaliveTimeout', description='The timeout period of idle persistent connections. Valid values: 1 to 60. Default value: 15. Unit: seconds.

>  This parameter specifies the period of time after which an idle persistent connection is closed.', example='15'),
    loadbalance?: string(name='Loadbalance', description='The load balancing algorithm that you want to use to forward requests to the origin server. Valid values:

*   **iphash**
*   **roundRobin**
*   **leastTime**: This value is available only if you set **ProtectionResource** to **gslb**.

This parameter is required.', example='iphash'),
    readTimeout?: int32(name='ReadTimeout', description='The timeout period of read connections. Unit: seconds. Valid values: 1 to 3600.', example='200'),
    requestHeaders?: [ 
      {
        key?: string(name='Key', description='The key of the custom header field.', example='aaa'),
        value?: string(name='Value', description='The value of the custom header field.', example='bbb'),
      }
    ](name='RequestHeaders', description='The custom header fields, which are key-value pairs. The fields are used to mark requests that pass through WAF.

When a request passes through WAF, WAF automatically adds the custom header fields to the request to mark the request. This way, the backend service can identify requests that are processed by WAF.'),
    retry?: boolean(name='Retry', description='Specifies whether WAF retries if WAF fails to forward requests to the origin server. Valid values:

*   **true** (default)
*   **false**', example='true'),
    routingRules?: string(name='RoutingRules', description='The forwarding rules for the hybrid cloud mode. The value is a string that consists of JSON arrays. Each element in a JSON array is a JSON struct that contains the following fields:

*   **rs**: the back-to-origin IP addresses or CNAMEs. Data type: array.
*   **location**: the name of the protection node. Data type: string.
*   **locationId**: the ID of the protection node. Data type: long.', example='[
      {
            "rs": [
                  "1.1.XX.XX"
            ],
            "locationId": 535,
            "location": "test1111"
      }
]'),
    sniEnabled?: boolean(name='SniEnabled', description='Specifies whether to enable the Server Name Indication (SNI) feature for back-to-origin requests. This parameter is available only if you specify **HttpsPorts**. Valid values:

*   **true**
*   **false** (default)', example='true'),
    sniHost?: string(name='SniHost', description='The custom value of the SNI field. If you do not specify this parameter, the value of the **Host** header field is automatically used. In most cases, you do not need to specify a custom value for the SNI field. However, if you want WAF to use an SNI field whose value is different from the value of the Host header field in back-to-origin requests, you can specify a custom value for the SNI field.

>  This parameter is required only if you set **SniEnabled** to true.', example='www.aliyundoc.com'),
    writeTimeout?: int32(name='WriteTimeout', description='The timeout period of write connections. Unit: seconds. Valid values: 1 to 3600.', example='200'),
    xffProto?: boolean(name='XffProto', description='Specifies whether to use the X-Forward-For-Proto header field to pass the protocol used by WAF to forward requests to the origin server. Valid values:

*   **true** (default)
*   **false**', example='true'),
  }(name='Redirect', description='The forwarding configurations.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
}

model ModifyDomainShrinkRequest {
  accessType?: string(name='AccessType', description='The mode in which you want to add the domain name to WAF. Set the value to share.

*   **share:** adds the domain name to WAF in CNAME record mode. This is the default value.', example='share'),
  domain?: string(name='Domain', description='The domain name whose access configurations you want to modify.

This parameter is required.', example='www.aliyundoc.com'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  listenShrink?: string(name='Listen', description='The listener configurations.

This parameter is required.'),
  redirectShrink?: string(name='Redirect', description='The forwarding configurations.

This parameter is required.'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
}

model ModifyDomainResponseBody = {
  domainInfo?: {
    cname?: string(name='Cname', description='The CNAME that is assigned by WAF to the domain name.', example='xxxxxcvdaf.****.com'),
    domain?: string(name='Domain', description='The domain name whose access configurations you modified.', example='www.aliyundoc.com'),
    domainId?: string(name='DomainId', description='The ID of the domain name.', example='www.aliyundoc.com-waf'),
  }(name='DomainInfo', description='The information about the domain name.'),
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyDomainResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDomainResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a domain name that is added to Web Application Firewall (WAF) in CNAME record mode.
 *
 * @param tmpReq ModifyDomainRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDomainResponse
 */
async function modifyDomainWithOptions(tmpReq: ModifyDomainRequest, runtime: $RuntimeOptions): ModifyDomainResponse {
  tmpReq.validate();
  var request = new ModifyDomainShrinkRequest{};
  OpenApiUtil.convert(tmpReq, request);
  if (!$isNull(tmpReq.listen)) {
    request.listenShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.listen, 'Listen', 'json');
  }
  if (!$isNull(tmpReq.redirect)) {
    request.redirectShrink = OpenApiUtil.arrayToStringWithSpecifiedStyle(tmpReq.redirect, 'Redirect', 'json');
  }
  var query = {};
  if (!$isNull(request.accessType)) {
    query['AccessType'] = request.accessType;
  }
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.listenShrink)) {
    query['Listen'] = request.listenShrink;
  }
  if (!$isNull(request.redirectShrink)) {
    query['Redirect'] = request.redirectShrink;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDomain',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a domain name that is added to Web Application Firewall (WAF) in CNAME record mode.
 *
 * @param request ModifyDomainRequest
 * @return ModifyDomainResponse
 */
async function modifyDomain(request: ModifyDomainRequest): ModifyDomainResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDomainWithOptions(request, runtime);
}

model ModifyDomainPunishStatusRequest {
  domain?: string(name='Domain', description='The domain name that is penalized for failing to obtain an ICP filing.

This parameter is required.', example='demo.xxxxaliyundoc.com'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

> You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v2_public_cn-zxu****0g02'),
  regionId?: string(name='RegionId', description='The region of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ModifyDomainPunishStatusResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='70E65A35-22B8-567C-B0A0-A2E9****20AE'),
}

model ModifyDomainPunishStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDomainPunishStatusResponseBody(name='body'),
}

/**
 * @summary Re-adds a domain name that is penalized for failing to obtain an Internet Content Provider (ICP) filing to Web Application Firewall (WAF).
 *
 * @param request ModifyDomainPunishStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDomainPunishStatusResponse
 */
async function modifyDomainPunishStatusWithOptions(request: ModifyDomainPunishStatusRequest, runtime: $RuntimeOptions): ModifyDomainPunishStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.domain)) {
    query['Domain'] = request.domain;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyDomainPunishStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Re-adds a domain name that is penalized for failing to obtain an Internet Content Provider (ICP) filing to Web Application Firewall (WAF).
 *
 * @param request ModifyDomainPunishStatusRequest
 * @return ModifyDomainPunishStatusResponse
 */
async function modifyDomainPunishStatus(request: ModifyDomainPunishStatusRequest): ModifyDomainPunishStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyDomainPunishStatusWithOptions(request, runtime);
}

model ModifyHybridCloudClusterBypassStatusRequest {
  clusterResourceId?: string(name='ClusterResourceId', description='The ID of the hybrid cloud cluster.

This parameter is required.', example='hdbc_cluster_****'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

**

**You can call the **DescribeInstanceInfo[ operation to obtain the ID of the WAF instance.](https://help.aliyun.com/document_detail/140857.html)

This parameter is required.', example='waf_elasticity-cn-0xldbqt****'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  ruleStatus?: string(name='RuleStatus', description='The status of manual bypass. Valid values:

*   **on**: enabled.
*   **off**: disabled. This is the default value.

This parameter is required.', example='on'),
}

model ModifyHybridCloudClusterBypassStatusResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19160D5EB0'),
}

model ModifyHybridCloudClusterBypassStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHybridCloudClusterBypassStatusResponseBody(name='body'),
}

/**
 * @summary Enables or disables manual bypass for a hybrid cloud cluster whose type is set to SDK Integration Mode.
 *
 * @param request ModifyHybridCloudClusterBypassStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHybridCloudClusterBypassStatusResponse
 */
async function modifyHybridCloudClusterBypassStatusWithOptions(request: ModifyHybridCloudClusterBypassStatusRequest, runtime: $RuntimeOptions): ModifyHybridCloudClusterBypassStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterResourceId)) {
    query['ClusterResourceId'] = request.clusterResourceId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleStatus)) {
    query['RuleStatus'] = request.ruleStatus;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyHybridCloudClusterBypassStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables or disables manual bypass for a hybrid cloud cluster whose type is set to SDK Integration Mode.
 *
 * @param request ModifyHybridCloudClusterBypassStatusRequest
 * @return ModifyHybridCloudClusterBypassStatusResponse
 */
async function modifyHybridCloudClusterBypassStatus(request: ModifyHybridCloudClusterBypassStatusRequest): ModifyHybridCloudClusterBypassStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyHybridCloudClusterBypassStatusWithOptions(request, runtime);
}

model ModifyHybridCloudClusterRuleRequest {
  clusterId?: long(name='ClusterId', description='The ID of the hybrid cloud cluster.

This parameter is required.', example='1018'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the DescribeInstanceInfo operation to query the ID of the WAF instance.[](~~140857~~)

This parameter is required.', example='waf-cn-n6w***x52m'),
  regionId?: string(name='RegionId', description='The region of the WAF instance. Valid value:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  ruleConfig?: string(name='RuleConfig', description='The configuration of the rule.', example='{\\\\"check_mode\\\\":\\\\"part\\\\",\\\\"include\\\\":{\\\\"exact\\\\":[],\\\\"regex\\\\":[]}}'),
  ruleStatus?: string(name='RuleStatus', description='The status of the rule. Valid values:

*   **on**: enables the rule.
*   **off**: disables the rule.

This parameter is required.', example='on'),
  ruleType?: string(name='RuleType', description='The type of the rule. Valid values:

*   **pullin**: The traffic redirection rule.

This parameter is required.', example='pullin'),
}

model ModifyHybridCloudClusterRuleResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='03D73D88-57D8-5BA2-96A4-6357CE***19'),
}

model ModifyHybridCloudClusterRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHybridCloudClusterRuleResponseBody(name='body'),
}

/**
 * @summary Modifies the rule of a hybrid cloud cluster.
 *
 * @param request ModifyHybridCloudClusterRuleRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHybridCloudClusterRuleResponse
 */
async function modifyHybridCloudClusterRuleWithOptions(request: ModifyHybridCloudClusterRuleRequest, runtime: $RuntimeOptions): ModifyHybridCloudClusterRuleResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleConfig)) {
    query['RuleConfig'] = request.ruleConfig;
  }
  if (!$isNull(request.ruleStatus)) {
    query['RuleStatus'] = request.ruleStatus;
  }
  if (!$isNull(request.ruleType)) {
    query['RuleType'] = request.ruleType;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyHybridCloudClusterRule',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the rule of a hybrid cloud cluster.
 *
 * @param request ModifyHybridCloudClusterRuleRequest
 * @return ModifyHybridCloudClusterRuleResponse
 */
async function modifyHybridCloudClusterRule(request: ModifyHybridCloudClusterRuleRequest): ModifyHybridCloudClusterRuleResponse {
  var runtime = new $RuntimeOptions{};
  return modifyHybridCloudClusterRuleWithOptions(request, runtime);
}

model ModifyHybridCloudGroupRequest {
  clusterId?: long(name='ClusterId', description='The ID of the cluster.

This parameter is required.', example='1'),
  groupId?: long(name='GroupId', description='The ID of the node group.

This parameter is required.', example='1'),
  groupName?: string(name='GroupName', description='The name of the node group.

This parameter is required.', example='demo'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid value:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  remark?: string(name='Remark', description='The remarks.', example='test'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ModifyHybridCloudGroupResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19160D***0'),
}

model ModifyHybridCloudGroupResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHybridCloudGroupResponseBody(name='body'),
}

/**
 * @summary Modifies a node group in a hybrid cloud cluster.
 *
 * @param request ModifyHybridCloudGroupRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHybridCloudGroupResponse
 */
async function modifyHybridCloudGroupWithOptions(request: ModifyHybridCloudGroupRequest, runtime: $RuntimeOptions): ModifyHybridCloudGroupResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!$isNull(request.groupName)) {
    query['GroupName'] = request.groupName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.remark)) {
    query['Remark'] = request.remark;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyHybridCloudGroup',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a node group in a hybrid cloud cluster.
 *
 * @param request ModifyHybridCloudGroupRequest
 * @return ModifyHybridCloudGroupResponse
 */
async function modifyHybridCloudGroup(request: ModifyHybridCloudGroupRequest): ModifyHybridCloudGroupResponse {
  var runtime = new $RuntimeOptions{};
  return modifyHybridCloudGroupWithOptions(request, runtime);
}

model ModifyHybridCloudGroupExpansionServerRequest {
  clusterId?: long(name='ClusterId', description='The ID of the hybrid cloud cluster.

This parameter is required.', example='1'),
  groupId?: long(name='GroupId', description='The ID of the node group.

This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  mids?: string(name='Mids', description='The ID of the node.

This parameter is required.', example='612929b133e7ff**0d0'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ModifyHybridCloudGroupExpansionServerResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='7BD7F9A1-0E72-5BC1-8248-C629B4***B6'),
}

model ModifyHybridCloudGroupExpansionServerResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHybridCloudGroupExpansionServerResponseBody(name='body'),
}

/**
 * @summary Adds a node to a node group of a hybrid cloud cluster.
 *
 * @param request ModifyHybridCloudGroupExpansionServerRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHybridCloudGroupExpansionServerResponse
 */
async function modifyHybridCloudGroupExpansionServerWithOptions(request: ModifyHybridCloudGroupExpansionServerRequest, runtime: $RuntimeOptions): ModifyHybridCloudGroupExpansionServerResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.mids)) {
    query['Mids'] = request.mids;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyHybridCloudGroupExpansionServer',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Adds a node to a node group of a hybrid cloud cluster.
 *
 * @param request ModifyHybridCloudGroupExpansionServerRequest
 * @return ModifyHybridCloudGroupExpansionServerResponse
 */
async function modifyHybridCloudGroupExpansionServer(request: ModifyHybridCloudGroupExpansionServerRequest): ModifyHybridCloudGroupExpansionServerResponse {
  var runtime = new $RuntimeOptions{};
  return modifyHybridCloudGroupExpansionServerWithOptions(request, runtime);
}

model ModifyHybridCloudGroupShrinkServerRequest {
  clusterId?: long(name='ClusterId', description='The ID of the hybrid cloud cluster.

This parameter is required.', example='1'),
  groupId?: long(name='GroupId', description='The ID of the node group.

This parameter is required.', example='1'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_elasticity-cn-0xldb****05'),
  mids?: string(name='Mids', description='The ID of the node.

This parameter is required.', example='b1bf3f544f30c1de0b72d91290***bbbb'),
  regionId?: string(name='RegionId', description='The region of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm2th****v6ay'),
}

model ModifyHybridCloudGroupShrinkServerResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model ModifyHybridCloudGroupShrinkServerResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHybridCloudGroupShrinkServerResponseBody(name='body'),
}

/**
 * @summary Deletes a node from a node group of a hybrid cloud cluster.
 *
 * @param request ModifyHybridCloudGroupShrinkServerRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHybridCloudGroupShrinkServerResponse
 */
async function modifyHybridCloudGroupShrinkServerWithOptions(request: ModifyHybridCloudGroupShrinkServerRequest, runtime: $RuntimeOptions): ModifyHybridCloudGroupShrinkServerResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.clusterId)) {
    query['ClusterId'] = request.clusterId;
  }
  if (!$isNull(request.groupId)) {
    query['GroupId'] = request.groupId;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.mids)) {
    query['Mids'] = request.mids;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyHybridCloudGroupShrinkServer',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a node from a node group of a hybrid cloud cluster.
 *
 * @param request ModifyHybridCloudGroupShrinkServerRequest
 * @return ModifyHybridCloudGroupShrinkServerResponse
 */
async function modifyHybridCloudGroupShrinkServer(request: ModifyHybridCloudGroupShrinkServerRequest): ModifyHybridCloudGroupShrinkServerResponse {
  var runtime = new $RuntimeOptions{};
  return modifyHybridCloudGroupShrinkServerWithOptions(request, runtime);
}

model ModifyHybridCloudSdkPullinStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-7pp2le***01'),
  mid?: string(name='Mid', description='The ID of the SDK.

This parameter is required.', example='b3dbc5153317c79d8ca9f9***ea'),
  pullinStatus?: string(name='PullinStatus', description='The status of traffic redirection. Valid values:

*   **on**
*   **off**

This parameter is required.', example='on'),
}

model ModifyHybridCloudSdkPullinStatusResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='D7861F61-5B61-46CE-A47C-6B191**EB0'),
}

model ModifyHybridCloudSdkPullinStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHybridCloudSdkPullinStatusResponseBody(name='body'),
}

/**
 * @summary Modifies the traffic redirection status of a hybrid cloud cluster by using an SDK.
 *
 * @param request ModifyHybridCloudSdkPullinStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHybridCloudSdkPullinStatusResponse
 */
async function modifyHybridCloudSdkPullinStatusWithOptions(request: ModifyHybridCloudSdkPullinStatusRequest, runtime: $RuntimeOptions): ModifyHybridCloudSdkPullinStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.mid)) {
    query['Mid'] = request.mid;
  }
  if (!$isNull(request.pullinStatus)) {
    query['PullinStatus'] = request.pullinStatus;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyHybridCloudSdkPullinStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the traffic redirection status of a hybrid cloud cluster by using an SDK.
 *
 * @param request ModifyHybridCloudSdkPullinStatusRequest
 * @return ModifyHybridCloudSdkPullinStatusResponse
 */
async function modifyHybridCloudSdkPullinStatus(request: ModifyHybridCloudSdkPullinStatusRequest): ModifyHybridCloudSdkPullinStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyHybridCloudSdkPullinStatusWithOptions(request, runtime);
}

model ModifyHybridCloudServerRequest {
  continents?: string(name='Continents', description='The continent.

This parameter is required.', example='asiapacific'),
  customName?: string(name='CustomName', description='The name of the node.

This parameter is required.', example='demo'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstanceInfo](https://help.aliyun.com/document_detail/140857.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  mid?: string(name='Mid', description='The ID of the node.

This parameter is required.', example='b1bf3f544f30c1de0b72d91290**ccb'),
  operator?: string(name='Operator', description='The cloud service provider.

This parameter is required.', example='aliyun'),
  regionCode?: string(name='RegionCode', description='The city.

This parameter is required.', example='beijing'),
  regionId?: string(name='RegionId', description='The region of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ModifyHybridCloudServerResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='26DCD663-5EB8-5103-B270-E24A32***5F0'),
}

model ModifyHybridCloudServerResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyHybridCloudServerResponseBody(name='body'),
}

/**
 * @summary Modifies the information about a hybrid cloud node.
 *
 * @param request ModifyHybridCloudServerRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyHybridCloudServerResponse
 */
async function modifyHybridCloudServerWithOptions(request: ModifyHybridCloudServerRequest, runtime: $RuntimeOptions): ModifyHybridCloudServerResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.continents)) {
    query['Continents'] = request.continents;
  }
  if (!$isNull(request.customName)) {
    query['CustomName'] = request.customName;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.mid)) {
    query['Mid'] = request.mid;
  }
  if (!$isNull(request.operator)) {
    query['Operator'] = request.operator;
  }
  if (!$isNull(request.regionCode)) {
    query['RegionCode'] = request.regionCode;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyHybridCloudServer',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the information about a hybrid cloud node.
 *
 * @param request ModifyHybridCloudServerRequest
 * @return ModifyHybridCloudServerResponse
 */
async function modifyHybridCloudServer(request: ModifyHybridCloudServerRequest): ModifyHybridCloudServerResponse {
  var runtime = new $RuntimeOptions{};
  return modifyHybridCloudServerWithOptions(request, runtime);
}

model ModifyMajorProtectionBlackIpRequest {
  description?: string(name='Description', description='The description of the IP address blacklist.', example='test'),
  expiredTime?: long(name='ExpiredTime', description='The time after which the IP address blacklist becomes invalid. Unit: seconds.

>  If you set this parameter to **0**, the blacklist is permanently valid.

This parameter is required.', example='1662603328'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  ipList?: string(name='IpList', description='The IP addresses that you want to add to the IP address blacklist. You can specify multiple CIDR blocks or IP addresses. IPv4 and IPv6 addresses are supported. Separate the CIDR blocks or IP addresses with commas (,). For more information, see [Protection for major events](https://help.aliyun.com/document_detail/425591.html).

This parameter is required.', example='12.XX.XX.2,3.XX.XX.3/24'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  ruleId?: long(name='RuleId', description='The ID of the IP address blacklist rule for major event protection.

This parameter is required.', example='20012033'),
  templateId?: long(name='TemplateId', description='The ID of the IP address blacklist rule template for major event protection.

This parameter is required.', example='5132'),
}

model ModifyMajorProtectionBlackIpResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='66A98669-CC6E-4F3E-80A6-3014697B11AE'),
}

model ModifyMajorProtectionBlackIpResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyMajorProtectionBlackIpResponseBody(name='body'),
}

/**
 * @summary Modifies an IP address blacklist for major event protection.
 *
 * @param request ModifyMajorProtectionBlackIpRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyMajorProtectionBlackIpResponse
 */
async function modifyMajorProtectionBlackIpWithOptions(request: ModifyMajorProtectionBlackIpRequest, runtime: $RuntimeOptions): ModifyMajorProtectionBlackIpResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.expiredTime)) {
    query['ExpiredTime'] = request.expiredTime;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.ipList)) {
    query['IpList'] = request.ipList;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.ruleId)) {
    query['RuleId'] = request.ruleId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyMajorProtectionBlackIp',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies an IP address blacklist for major event protection.
 *
 * @param request ModifyMajorProtectionBlackIpRequest
 * @return ModifyMajorProtectionBlackIpResponse
 */
async function modifyMajorProtectionBlackIp(request: ModifyMajorProtectionBlackIpRequest): ModifyMajorProtectionBlackIpResponse {
  var runtime = new $RuntimeOptions{};
  return modifyMajorProtectionBlackIpWithOptions(request, runtime);
}

model ModifyMemberAccountRequest {
  description?: string(name='Description', description='The description of the member. The description must be 1 to 256 characters in length, and can contain letters, digits, periods (.), underscores (_), hyphens (-), and asterisks (\\\\*).

This parameter is required.', example='account1'),
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_elasticity**-*******021'),
  memberAccountId?: string(name='MemberAccountId', description='The Alibaba Cloud account ID of the managed member.

This parameter is required.', example='131**********39'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  sourceIp?: string(name='SourceIp', description='The source IP address of the request. The system automatically obtains the value of this parameter.', example='0.0.XX.XX'),
}

model ModifyMemberAccountResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-5B61-46CE-A47C-6B19****5EB0'),
}

model ModifyMemberAccountResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyMemberAccountResponseBody(name='body'),
}

/**
 * @summary Modifies the information about members that are added for multi-account management.
 *
 * @param request ModifyMemberAccountRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyMemberAccountResponse
 */
async function modifyMemberAccountWithOptions(request: ModifyMemberAccountRequest, runtime: $RuntimeOptions): ModifyMemberAccountResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.description)) {
    query['Description'] = request.description;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.memberAccountId)) {
    query['MemberAccountId'] = request.memberAccountId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.sourceIp)) {
    query['SourceIp'] = request.sourceIp;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyMemberAccount',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the information about members that are added for multi-account management.
 *
 * @param request ModifyMemberAccountRequest
 * @return ModifyMemberAccountResponse
 */
async function modifyMemberAccount(request: ModifyMemberAccountRequest): ModifyMemberAccountResponse {
  var runtime = new $RuntimeOptions{};
  return modifyMemberAccountWithOptions(request, runtime);
}

model ModifyPauseProtectionStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf-cn-tl32ast****'),
  pauseStatus?: int32(name='PauseStatus', description='Specifies whether to pause WAF protection.

*   **0**: does not pause WAF protection. This is the default value.
*   **1**: pauses WAF protection.

This parameter is required.', example='0'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ModifyPauseProtectionStatusResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='D7861F61-*****-******-D5EB0'),
}

model ModifyPauseProtectionStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyPauseProtectionStatusResponseBody(name='body'),
}

/**
 * @summary Modifies the protection status of Web Application Firewall (WAF).
 *
 * @param request ModifyPauseProtectionStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyPauseProtectionStatusResponse
 */
async function modifyPauseProtectionStatusWithOptions(request: ModifyPauseProtectionStatusRequest, runtime: $RuntimeOptions): ModifyPauseProtectionStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.pauseStatus)) {
    query['PauseStatus'] = request.pauseStatus;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyPauseProtectionStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the protection status of Web Application Firewall (WAF).
 *
 * @param request ModifyPauseProtectionStatusRequest
 * @return ModifyPauseProtectionStatusResponse
 */
async function modifyPauseProtectionStatus(request: ModifyPauseProtectionStatusRequest): ModifyPauseProtectionStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyPauseProtectionStatusWithOptions(request, runtime);
}

model ModifyResourceLogStatusRequest {
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf-cn-zz11zcl****'),
  regionId?: string(name='RegionId', description='The region where the WAF instance resides. Valid values:

*   **cn-hangzhou:** the Chinese mainland.
*   **ap-southeast-1:** outside the Chinese mainland.', example='cn-hangzhou'),
  resource?: string(name='Resource', description='The protected object on which you want to manage the log collection feature.

This parameter is required.', example='alb-wewbb23dfsetetcic1242-0****'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the resource group.', example='rg-acfm***q'),
  status?: boolean(name='Status', description='Specifies whether to enable the log collection feature for the protected object. Valid values:

*   **true:** enables the log collection feature.
*   **false:** disables the log collection feature.

This parameter is required.', example='true'),
}

model ModifyResourceLogStatusResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='7C55A3E5-638A-5D6E-9A2F-C3CE5A677EC5'),
  status?: boolean(name='Status', description='Indicates whether the log collection feature is enabled for the protected object. Valid values:

*   **true**
*   **false**', example='true'),
}

model ModifyResourceLogStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyResourceLogStatusResponseBody(name='body'),
}

/**
 * @summary Enables or disables the log collection feature for a protected object.
 *
 * @param request ModifyResourceLogStatusRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyResourceLogStatusResponse
 */
async function modifyResourceLogStatusWithOptions(request: ModifyResourceLogStatusRequest, runtime: $RuntimeOptions): ModifyResourceLogStatusResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resource)) {
    query['Resource'] = request.resource;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.status)) {
    query['Status'] = request.status;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyResourceLogStatus',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Enables or disables the log collection feature for a protected object.
 *
 * @param request ModifyResourceLogStatusRequest
 * @return ModifyResourceLogStatusResponse
 */
async function modifyResourceLogStatus(request: ModifyResourceLogStatusRequest): ModifyResourceLogStatusResponse {
  var runtime = new $RuntimeOptions{};
  return modifyResourceLogStatusWithOptions(request, runtime);
}

model ModifyTemplateResourcesRequest {
  bindResourceGroups?: [ string ](name='BindResourceGroups', description='The protected object groups that you want to associate with the template. Specify the value in the [**"group1","group2",...**] format.'),
  bindResources?: [ string ](name='BindResources', description='The protected objects that you want to associate with the template. Specify the value in the [**"XX1","XX2",...**] format.'),
  instanceId?: string(name='InstanceId', description='The ID of the Web Application Firewall (WAF) instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to obtain the ID of the WAF instance.

This parameter is required.', example='waf_cdnsdf3****'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
  templateId?: long(name='TemplateId', description='The ID of the protection rule template.

This parameter is required.', example='2291'),
  unbindResourceGroups?: [ string ](name='UnbindResourceGroups', description='The protected object groups that you want to disassociate from the template. Specify the value in the [**"group1","group2",...**] format.'),
  unbindResources?: [ string ](name='UnbindResources', description='The protected objects that you want to disassociate from the template. Specify the value in the [**"XX1","XX2",...**] format.'),
}

model ModifyTemplateResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='CF708F2F-FFB0-54D4-B1E0-B84A7CEBFB60'),
}

model ModifyTemplateResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyTemplateResourcesResponseBody(name='body'),
}

/**
 * @summary Associates or disassociates a protected object or protected object group with or from a protection rule template.
 *
 * @param request ModifyTemplateResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyTemplateResourcesResponse
 */
async function modifyTemplateResourcesWithOptions(request: ModifyTemplateResourcesRequest, runtime: $RuntimeOptions): ModifyTemplateResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.bindResourceGroups)) {
    query['BindResourceGroups'] = request.bindResourceGroups;
  }
  if (!$isNull(request.bindResources)) {
    query['BindResources'] = request.bindResources;
  }
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  if (!$isNull(request.templateId)) {
    query['TemplateId'] = request.templateId;
  }
  if (!$isNull(request.unbindResourceGroups)) {
    query['UnbindResourceGroups'] = request.unbindResourceGroups;
  }
  if (!$isNull(request.unbindResources)) {
    query['UnbindResources'] = request.unbindResources;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ModifyTemplateResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Associates or disassociates a protected object or protected object group with or from a protection rule template.
 *
 * @param request ModifyTemplateResourcesRequest
 * @return ModifyTemplateResourcesResponse
 */
async function modifyTemplateResources(request: ModifyTemplateResourcesRequest): ModifyTemplateResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return modifyTemplateResourcesWithOptions(request, runtime);
}

model ReleaseInstanceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  Obtain the ID of the WAF instance by calling the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation.

This parameter is required.', example='waf_v2_public_cn-***'),
  regionId?: string(name='RegionId', description='The region in which the WAF instance is deployed. Valid values:

*   **cn-hangzhou**: the Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm***q'),
}

model ReleaseInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The ID of the request.', example='65626467-8002-5022-9F5F-***'),
}

model ReleaseInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ReleaseInstanceResponseBody(name='body'),
}

/**
 * @summary Releases a Web Application Firewall (WAF) 3.0 instance.
 *
 * @param request ReleaseInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return ReleaseInstanceResponse
 */
async function releaseInstanceWithOptions(request: ReleaseInstanceRequest, runtime: $RuntimeOptions): ReleaseInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'ReleaseInstance',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Releases a Web Application Firewall (WAF) 3.0 instance.
 *
 * @param request ReleaseInstanceRequest
 * @return ReleaseInstanceResponse
 */
async function releaseInstance(request: ReleaseInstanceRequest): ReleaseInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return releaseInstanceWithOptions(request, runtime);
}

model SyncProductInstanceRequest {
  instanceId?: string(name='InstanceId', description='The ID of the WAF instance.

>  You can call the [DescribeInstance](https://help.aliyun.com/document_detail/433756.html) operation to query the ID of the WAF instance.

This parameter is required.', example='waf_v3prepaid_public_cn-zsk****fb09'),
  regionId?: string(name='RegionId', description='The region ID of the WAF instance. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.', example='cn-hangzhou'),
  resourceManagerResourceGroupId?: string(name='ResourceManagerResourceGroupId', description='The ID of the Alibaba Cloud resource group.', example='rg-acfm4co****f5qa'),
}

model SyncProductInstanceResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='45BA2382-7C3F-5B29-9A83-C3BCE586****'),
}

model SyncProductInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: SyncProductInstanceResponseBody(name='body'),
}

/**
 * @summary Synchronizes Elastic Compute Service (ECS), Classic Load Balancer (CLB), and Network Load Balancer (NLB) instances to Web Application Firewall (WAF).
 *
 * @description SyncProductInstance is an asynchronous operation. You can call the [DescribeProductInstances](https://help.aliyun.com/document_detail/2743168.html) operation to query the status of the task.
 *
 * @param request SyncProductInstanceRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return SyncProductInstanceResponse
 */
async function syncProductInstanceWithOptions(request: SyncProductInstanceRequest, runtime: $RuntimeOptions): SyncProductInstanceResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.instanceId)) {
    query['InstanceId'] = request.instanceId;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceManagerResourceGroupId)) {
    query['ResourceManagerResourceGroupId'] = request.resourceManagerResourceGroupId;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'SyncProductInstance',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Synchronizes Elastic Compute Service (ECS), Classic Load Balancer (CLB), and Network Load Balancer (NLB) instances to Web Application Firewall (WAF).
 *
 * @description SyncProductInstance is an asynchronous operation. You can call the [DescribeProductInstances](https://help.aliyun.com/document_detail/2743168.html) operation to query the status of the task.
 *
 * @param request SyncProductInstanceRequest
 * @return SyncProductInstanceResponse
 */
async function syncProductInstance(request: SyncProductInstanceRequest): SyncProductInstanceResponse {
  var runtime = new $RuntimeOptions{};
  return syncProductInstanceWithOptions(request, runtime);
}

model TagResourcesRequest {
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: Outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The IDs of the resources. You can specify up to 50 resource IDs.

This parameter is required.'),
  resourceType?: string(name='ResourceType', description='The type of the resource. Set the value to ALIYUN::WAF::DEFENSERESOURCE.

This parameter is required.', example='ALIYUN::WAF::DEFENSERESOURCE'),
  tag?: [ 
    {
      key?: string(name='Key', description='The key of tag N to add to the resource. Valid values of N: 1 to 20.', example='demoTagKey'),
      value?: string(name='Value', description='The value of tag N to add to the resource. Valid values of N: 1 to 20.', example='demoTagValue'),
    }
  ](name='Tag', description='The tags to add to the resource.

This parameter is required.'),
}

model TagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='57F8460F-8A62-5D79-8ED5-653C****0C6B'),
}

model TagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: TagResourcesResponseBody(name='body'),
}

/**
 * @summary Adds tags to resources.
 *
 * @param request TagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return TagResourcesResponse
 */
async function tagResourcesWithOptions(request: TagResourcesRequest, runtime: $RuntimeOptions): TagResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.tag)) {
    query['Tag'] = request.tag;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'TagResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Adds tags to resources.
 *
 * @param request TagResourcesRequest
 * @return TagResourcesResponse
 */
async function tagResources(request: TagResourcesRequest): TagResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return tagResourcesWithOptions(request, runtime);
}

model UntagResourcesRequest {
  all?: boolean(name='All', description='Specifies whether to remove all tags from the specified resource groups or members. Valid values:

*   false (default)
*   true', example='false'),
  regionId?: string(name='RegionId', description='The region in which the Web Application Firewall (WAF) instance is deployed. Valid values:

*   **cn-hangzhou**: Chinese mainland.
*   **ap-southeast-1**: outside the Chinese mainland.

This parameter is required.', example='cn-hangzhou'),
  resourceId?: [ string ](name='ResourceId', description='The resource IDs. You can specify up to 50 resource IDs.

This parameter is required.'),
  resourceType?: string(name='ResourceType', description='The type of the resource. Set the value to ALIYUN::WAF::DEFENSERESOURCE.

This parameter is required.', example='ALIYUN::WAF::DEFENSERESOURCE'),
  tagKey?: [ string ](name='TagKey', description='The tag keys. You can specify up to 20 tag keys.'),
}

model UntagResourcesResponseBody = {
  requestId?: string(name='RequestId', description='The request ID.', example='7A4B8DB1-A8B0-5362-A65D-6A55****07C5'),
}

model UntagResourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UntagResourcesResponseBody(name='body'),
}

/**
 * @summary Removes tags from resources and then deletes the tags.
 *
 * @param request UntagResourcesRequest
 * @param runtime runtime options for this request RuntimeOptions
 * @return UntagResourcesResponse
 */
async function untagResourcesWithOptions(request: UntagResourcesRequest, runtime: $RuntimeOptions): UntagResourcesResponse {
  request.validate();
  var query = {};
  if (!$isNull(request.all)) {
    query['All'] = request.all;
  }
  if (!$isNull(request.regionId)) {
    query['RegionId'] = request.regionId;
  }
  if (!$isNull(request.resourceId)) {
    query['ResourceId'] = request.resourceId;
  }
  if (!$isNull(request.resourceType)) {
    query['ResourceType'] = request.resourceType;
  }
  if (!$isNull(request.tagKey)) {
    query['TagKey'] = request.tagKey;
  }
  var req = new OpenApiUtil.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApiUtil.Params{
    action = 'UntagResources',
    version = '2021-10-01',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Removes tags from resources and then deletes the tags.
 *
 * @param request UntagResourcesRequest
 * @return UntagResourcesResponse
 */
async function untagResources(request: UntagResourcesRequest): UntagResourcesResponse {
  var runtime = new $RuntimeOptions{};
  return untagResourcesWithOptions(request, runtime);
}

